[issue2603] Make range __eq__ work
report at bugs.python.org
Wed Apr 16 22:16:18 CEST 2008
Alexander Belopolsky <belopolsky at users.sourceforge.net> added the comment:
On Wed, Apr 16, 2008 at 3:40 PM, Antoine Pitrou <report at bugs.python.org> wrote:
> Why would you want to have hash(range(a,b,c)) == hash((a,b,c)) ?
No particular reason other than that this is easy to test and gives
some assurance that hash values are reasonable.
> It'd be more logical to have hash(range(a,b,c)) ==
> hash(tuple(range(a,b,c))) ... which is not the same thing at all :)
No, this is not correct because range(..) == range(..) is not the same
as tuple(range(..)) == tuple(range(..)) in the proposed
implementation. See Guido's example above and Benjamin's test case in
the eq5 patch.
Tracker <report at bugs.python.org>
More information about the Python-bugs-list