<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    On 03/21/2012 10:01 PM, Eric Blake wrote:
    <blockquote cite="mid:4F69DF49.4080102@redhat.com" type="cite"><br>
      <pre wrap="">
Only if we want to be sticklers.  For reference, in C,

void foo(bool x);

can be called with a bool (foo(true) or foo(false)), an int (foo(1) or
foo(0)), a pointer (foo("") or foo(NULL)).  That is, C gives you
automatic conversion.

In Java, you _have_ to pass a boolean, where

void foo(boolean x) {}

must be called as foo(true), foo(i != 0), foo(str != null), and so
forth, which puts more burden on the caller to do the type conversion up
front.

Which style describes python code?  Is python type-strict, where you
have to manually convert to bool in contexts that demand a PyBool, or do
you get automatic conversion where the empty string, None, integer 0,
and other python objects can be implicitly used in place of the actual
False object?  Depending on that answer determines whether you should be
using PyBool_Check and rejecting invalid types, or whether you allow all
python objects with their normal conversion to boolean.  And my limited
understanding (given that I have not done much python coding) is that
python is relaxed like C, not strict like Java.  In other words, I think
we should allow users to call dom.getCPUStats(0, 0) rather than forcing
them to call dom.getCPUStats(False, 0), if that is the convention
allowed elsewhere in native python code.

</pre>
    </blockquote>
          Thanks for these ideas<br>
          I totally agree with them. <br>
    <br>
          Guannan Ren<br>
    <br>
        <br>
    <strong class="text_blue"></strong>
  </body>
</html>