Benjamin Peterson wrote:
2011/9/23 Ethan Furman <et...@stoneleaf.us>:
Benjamin Peterson wrote:
2011/9/23 Ethan Furman <et...@stoneleaf.us>:

Follow-up question: since the original range returned lists, and
comparisons
do make sense for lists, should the new range also implement them?
What would be the use-case?
The only reason I'm aware of at the moment is to prevent loss of
functionality from 2.x range to 3.x range.

range comparisons in 2.x have no functionality.

Python 2.7 (r27:82525, Jul 4 2010, 09:01:59) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
--> r1 = range(10)
--> r2 = range(0, 20, 2)
--> r3 = range(10)
--> r1 == r3
True
--> r1 < r2
True
--> r3 > r2
False

Yes, I realize this is because range returned a list in 2.x. However, aren't __contains__, __getitem__, count, and index implemented in 3.x range because 2.x range returned lists?

~Ethan~
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to