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年01月29日 19:58 by catalin.iacob, last changed 2022年04月11日 14:57 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| issue13905v1.patch | catalin.iacob, 2012年01月29日 20:01 | review | ||
| Messages (3) | |||
|---|---|---|---|
| msg152254 - (view) | Author: Catalin Iacob (catalin.iacob) * | Date: 2012年01月29日 19:58 | |
In 2.7 the Comparisons section of stdtypes.rst only talks about __cmp__ and never mentions the rich comparison methods: "Instances of a class normally compare as non-equal unless the class defines the __cmp__() method. Refer to Basic customization) for information on the use of this method to effect object comparisons." The first sentence is false, instances can also compare as equal if they define __eq__. And since __cmp__ is gone in Python3, I think the rich comparison methods should at least be mentioned, or even emphasized over __cmp__ to help people write more forward compatible code. |
|||
| msg152255 - (view) | Author: Catalin Iacob (catalin.iacob) * | Date: 2012年01月29日 20:01 | |
Here's my attempt at a patch. It mostly takes the text from the default branch and adds references to __cmp__. |
|||
| msg199596 - (view) | Author: Roundup Robot (python-dev) (Python triager) | Date: 2013年10月12日 16:43 | |
New changeset 9f1e1da820fb by Georg Brandl in branch '2.7': Closes #13905: mention rich-comparison methods in addition to __cmp__ when documenting how to make classes comparable and orderable. http://hg.python.org/cpython/rev/9f1e1da820fb |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:26 | admin | set | github: 58113 |
| 2013年10月12日 16:43:48 | python-dev | set | status: open -> closed nosy: + python-dev messages: + msg199596 resolution: fixed stage: resolved |
| 2012年01月29日 20:01:56 | catalin.iacob | set | files:
+ issue13905v1.patch keywords: + patch messages: + msg152255 |
| 2012年01月29日 19:58:51 | catalin.iacob | create | |