This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author taleinat
Recipients Arfrever, llllllllll, mark.dickinson, rhettinger, serhiy.storchaka, steven.daprano, taleinat
Date 2015-06-09.19:17:03
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1433877424.34.0.506143746411.issue24379@psf.upfronthosting.co.za>
In-reply-to
Content
(see https://mail.python.org/mailman/listinfo/python-ideas)

But for x = [1,2,3,4], how will x[y] work for all of the following values of y?

y = slice.literal[0]
y = slice.literal[1:2]
y = slice.literal[0:1, ..., 3]

NumPy's s_ "magic object" is a factory, returning objects of different types depending on the given input. If you want an actual slice.literal class, then you'll have to supply a way to convert it into an object usable for indexing/slicing, e.g.:

y = slice.literal[0:1]
[1,2,3,4][y.as_indexer]
History
Date User Action Args
2015-06-09 19:17:04taleinatsetrecipients: + taleinat, rhettinger, mark.dickinson, Arfrever, steven.daprano, serhiy.storchaka, llllllllll
2015-06-09 19:17:04taleinatsetmessageid: <1433877424.34.0.506143746411.issue24379@psf.upfronthosting.co.za>
2015-06-09 19:17:04taleinatlinkissue24379 messages
2015-06-09 19:17:03taleinatcreate