Patches item #1410739, was opened at 2006-01-20 07:39
Message generated for change (Comment added) made by collinwinter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1410739&group_id=5470
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Documentation
Group: Python 2.4
Status: Open
Resolution: None
Priority: 5
Submitted By: Collin Winter (collinwinter)
Assigned to: Fred L. Drake, Jr. (fdrake)
Summary: Add notes to the manual about `is` and methods
Initial Comment:
This patch, made against svn revision 42105, adds
caveats to Doc/ref/ref3.tex concerning the use of the
`is` operator in conjunction with class- and
instance-methods.
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.
----------------------------------------------------------------------
>Comment By: Collin Winter (collinwinter)
Date: 2006-01-21 10:33
Message:
Logged In: YES
user_id=1344176
I'm not sure a full-blown caveat on `is` is a good idea,
unless this particular issue impacts areas beyond
{class,instance}methods (the only two places I've see it).
However, tacking a note to `is`, something like "you may
notice unusal behaviour in certain combinations of `is` and
class- and instancemethods; see their docs for more info",
would probably be a good idea.
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
"""
----------------------------------------------------------------------
Comment By: Michael Hudson (mwh)
Date: 2006-01-21 05:46
Message:
Logged In: YES
user_id=6656
I'm not really sure this patch is a good idea. It seems over-specific to one
particular pitfall. Maybe instead warning stickers should be attached to the
description of the 'is' operator.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1410739&group_id=5470
_______________________________________________
Patches mailing list
[email protected]
http://mail.python.org/mailman/listinfo/patches