[New-bugs-announce] [issue15773] `is' operator returns False on classmethods

Stefan Mihaila report at bugs.python.org
Fri Aug 24 01:35:07 CEST 2012


New submission from Stefan Mihaila:

Here are a few counter-intuitive outputs:

    >>> dict.fromkeys is dict.fromkeys
    False

    >>> id(dict.fromkeys) == id(dict.fromkeys)
    True

    >>> x=dict.fromkeys; id(x) == id(x)
    True

    >>> x=dict.fromkeys; id(x) == id(dict.fromkeys)
    False
    
    >>> x=dict.fromkeys; y=dict.fromkeys; id(x),id(y),id(dict.fromkeys)
    (39888824, 39064632, 39065144)

    >>> a=id(dict.fromkeys); x=dict.fromkeys; b=id(dict.fromkeys); a,b
    (39888824, 39480568)

Attached is a failing test.

----------
files: is_on_classmethods.py
messages: 168967
nosy: mstefanro
priority: normal
severity: normal
status: open
title: `is' operator returns False on classmethods
versions: Python 3.3
Added file: http://bugs.python.org/file26978/is_on_classmethods.py

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


More information about the New-bugs-announce mailing list