A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2011-September/113643.html below:

[Python-Dev] range objects in 3.x

[Python-Dev] range objects in 3.xEthan Furman ethan at stoneleaf.us
Sat Sep 24 00:24:24 CEST 2011
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~
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4