On Jul 26, 6:22 pm, Russ <[EMAIL PROTECTED]> wrote: > I posted a message on this several days ago, but it apparently got > lost > in googlespace, so I'll try it again. > > I recently discovered a bug in my code that apparently resulted from > the automatic conversion of a function pointer to an integer. > > Say you have a class member function called getCount(), which > returns an integer. Now suppose you write something like > > if obj.getCount < 3: ... > > This is an error because the parentheses were left off.
BTW, are you a former Pascal programmer? > But Python > somehow compares the function pointer with an integer without > complaining. Unless there is a darn good reason for allowing > comparisons of this type (and I can't think of one), I think > Python should flag this as an Exception. IIRC, the reason is for backwards compatibility with a long-obsolete version of Python in which it wasn't possible for __cmp__ to throw an exception. That's not darn good, so this behavior is already slated for removal in version 3.0. -- http://mail.python.org/mailman/listinfo/python-list