[C++-sig] strange behavior with respect to numeric and Boolean overloads
Hans Meine
meine at informatik.uni-hamburg.de
Tue Mar 17 11:03:10 CET 2009
On Monday 16 March 2009 22:52:16 Ralf W. Grosse-Kunstleve wrote:
> [...] Boost.Python 2 was written when the Python bool type still really
> was an int (Python 2.2). [...]
On Tuesday 17 March 2009 06:40:14 Roman Yakovenko wrote:
> Python code:
>
> def foo( arg ):
> if isinstance( arg, int ):
> _foo_int( arg )
> else:
> _foo_bool( arg )
Now I am confused. Both of the above read as if a boolean was no longer an
int, but I interpret "is a" and "isinstance" as checking for types inherited
from, too?! While Ralf could have meant (True is 1) with his "really", the
above code should first test whether isinstance( arg, bool ), no?
Or did this change with 2.6/3?
Greetings,
Hans
More information about the Cplusplus-sig
mailing list