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-February/002017.html below:

[Python-Dev] RE: slice objects

[Python-Dev] RE: slice objects [Python-Dev] RE: slice objectsDavid Ascher dascher@mindspring.com
Thu, 3 Feb 2000 12:14:26 -0800
> (While we're on the topic: is there an easy way to construct a slice
> like 3:10, pass it around as a variable, and later use it to index an
> arbitrary sequence?)

Sort of.  Slice objects can be created with the slice builtin.
slice(1,10,2) is meant to be equivalent to 1:10:2, but only NumPy knows how
to deal with slice objects in the getitem slot (use None to express
'omission' of an index).  It's on the TODO list for 1.7 at this point,
although if someone submits a working patch to 1.6, who knows...  JPython
does it right, I believe.

--david




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