[ python-Feature Requests-1191697 ] slice indices different than
integers
SourceForge.net
noreply at sourceforge.net
Thu Apr 28 15:42:46 CEST 2005
Feature Requests item #1191697, was opened at 2005-04-28 13:42
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=355470&aid=1191697&group_id=5470
Category: Python Interpreter Core
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Sebastien de Menten (sdementen)
Assigned to: Nobody/Anonymous (nobody)
Summary: slice indices different than integers
Initial Comment:
Hi,
Slice notation is quite convenient while addressing some
item in a collection.
It would be nice to extend this notation by enabling any
object instead of integer in slices.
Example 1: let time_serie be an object representing a
time serie and date and days object that manages dates
and concept of days interval, one could indexed
time_serie with:
time_serie[date(2004,3,4):date(2004,5,3)]
or
time_serie[date(2004,3,4):date(2004,5,3):days(5)]
Example 2:
Let f be a numerical function with multiple arguments,
one could get an array of results by using
f[3:10:2, 1:5:3]
or naturally :-)
f[3.2:10.1:0.4, 1:5:3]
Well, I think it is a matter of removing the check on
argument of slices to enable the syntactic sugar
start:end:step in __getitem__ calls as well as adding
integer checks on slice attributes when using it in old
way.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=355470&aid=1191697&group_id=5470
More information about the Python-bugs-list
mailing list