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/2000-July/006294.html below:

[Python-Dev] Ranges

[Python-Dev] RangesKa-Ping Yee pingster@ilm.com
Wed, 12 Jul 2000 12:48:54 -0700 (PDT)
On Wed, 12 Jul 2000, Paul Prescod wrote:
> That's not what I mean. Ignore the range. My point is, if list
> construction and truncation are going to be parallel, they should be
> really parallel.
> 
> [0,1,2,3,4,5,6,7,8,10][0:5:2]==[0:5:2]

Did you think they were different?

I thought they *were* parallel.  I would expect:

    >>> range(0, 5, 2)
    [0, 2, 4]

    >>> [0:5:2]
    [0, 2, 4]

    >>> [0,1,2,3,4,5,6,7,8,9,10][0:5:2]
    [0, 2, 4]

    >>> range(1000)[0:5:2]
    [0, 2, 4]

Right?

Am i misunderstanding how [x:y:z] should work?


-- ?!ng




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