[New-bugs-announce] [issue3828] Bound methods compare 'successfully' with ints

Andreas Kloeckner report at bugs.python.org
Wed Sep 10 16:08:31 CEST 2008


New submission from Andreas Kloeckner <inform at tiker.net>:

Check out this transcript:
8< -----------------------------------------------------------------------
Python 2.5.2 (r252:60911, Aug  8 2008, 09:22:44) 
[GCC 4.3.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> class A(object):
...   def b(self):
...     pass
... 
>>> a = A()
>>> a.b < 0
False
>>> 
8< -----------------------------------------------------------------------

I would argue that the 'successful' comparison of a bound method with an
int is undesirable. This especially bad when you're refactoring a class
property into a class method and the property used to get used in
comparisons.
Instead of the expected exceptions, you get weird behavior.

----------
components: Interpreter Core
messages: 72961
nosy: inducer
severity: normal
status: open
title: Bound methods compare 'successfully' with ints
type: behavior
versions: Python 2.5

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue3828>
_______________________________________


More information about the New-bugs-announce mailing list