This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2012年08月23日 23:35 by mstefanro, last changed 2022年04月11日 14:57 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| is_on_classmethods.py | mstefanro, 2012年08月23日 23:35 | |||
| Messages (2) | |||
|---|---|---|---|
| msg168967 - (view) | Author: Stefan Mihaila (mstefanro) * | Date: 2012年08月23日 23:35 | |
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. |
|||
| msg168968 - (view) | Author: Alyssa Coghlan (ncoghlan) * (Python committer) | Date: 2012年08月24日 00:50 | |
Bound methods are created dynamically on lookup, while object ids may be reused after the original object is destroyed. There's no bug here - just a combination of those two language behaviours that is frequently surprising to users that have just noticed it. There's not a lot we can do about that - it's a genuinely surprising moment in people's understanding of the way methods (and descriptors in general) work. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:35 | admin | set | github: 59977 |
| 2012年08月24日 00:50:13 | ncoghlan | set | status: open -> closed nosy: + ncoghlan messages: + msg168968 resolution: not a bug stage: resolved |
| 2012年08月24日 00:02:31 | mstefanro | set | type: behavior |
| 2012年08月23日 23:35:07 | mstefanro | create | |