[New-bugs-announce] [issue13905] Built-in Types Comparisons should mention rich comparison methods

Catalin Iacob report at bugs.python.org
Sun Jan 29 20:58:52 CET 2012


New submission from Catalin Iacob <iacobcatalin at gmail.com>:

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.

----------
assignee: docs at python
components: Documentation
messages: 152254
nosy: catalin.iacob, docs at python
priority: normal
severity: normal
status: open
title: Built-in Types Comparisons should mention rich comparison methods
type: enhancement
versions: Python 2.7

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue13905>
_______________________________________


More information about the New-bugs-announce mailing list