strange comparison result with 'is'
Yingjie Lan
lanyjie at yahoo.com
Mon Oct 17 04:42:04 EDT 2011
More information about the Python-list mailing list
Mon Oct 17 04:42:04 EDT 2011
- Previous message (by thread): define module in non-standard location?
- Next message (by thread): strange comparison result with 'is'
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hi all, This is quite strange when I used the Python shell with IDLE: >>> x = [] >>> id(getattr(x, 'pop')) == id(x.pop) True >>> getattr(x, 'pop') is x.pop False >>> I suppose since the two things have the same id, the 'is'-test should give a True value, but I get a False value. Any particular reason for breaking this test? I am quite confused as I show this before a large audience only to find the result denies my prediction. The python version is 3.2.2; I am not sure about other versions. Regards, Yingjie -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-list/attachments/20111017/5617c5f5/attachment.html>
- Previous message (by thread): define module in non-standard location?
- Next message (by thread): strange comparison result with 'is'
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list