New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add notes to the manual about is
and methods
#42812
Comments
This patch, made against svn revision 42105, adds As I was recently bitten by trying to do the equivalent of
"""
>>> MyClass.a_class_method is MyClass.a_class_method
False
>>>
"""
I thought the manual might benefit from coverage of
this as-yet-undocumented area. |
Logged In: YES I'm not really sure this patch is a good idea. It seems over-specific to one |
Logged In: YES I'm not sure a full-blown caveat on I tried to make the original doc patch as specific as
possible because it's a tricky problem. There's a good
explanation for the following behaviour, but until someone
expalins it to you, you're probably going to think it's a bug.
"""
>>> id(MyClass.class_method) == id(MyClass.class_method)
True
>>> MyClass.class_method is MyClass.class_method
False
""" |
An even more surprising example: >>> id([1]) == id([2])
True |
The example sure is surprising for somebody without intimate knowledge |
I agree it's not a good idea to be too much specific about this. The Due to automatic garbage-collection, free lists, and the dynamic nature |
Reworded a bit and applied as r64638. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: