Martin v. Löwis wrote:
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?
No, they are implemented because they are meaningful, and with an
obvious meaning. "Is 30 in the range from 10 to 40?" is something
that everybody will answer the same way. "What is the fifth element
of the range from 10 to 40?" may not have such a universal meaning,
but people familiar with the mathematical concept of an interval
can readily guess the answer (except that they may wonder whether
to start counting at 0 or 1).
"Is the range from 5 to 100 larger than the range from 10 to 100?"
is something that most people would answer as "yes" (I believe),
yet
py> range(5,100) > range(10,100)
False
Thanks, Martin!
I can see where there could be many interpretations about the meaning of
less-than and greater-than with regards to range.
~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