[Python-ideas] List assignment - extended slicing inconsistency
Chris Barker
chris.barker at noaa.gov
Fri Feb 23 13:24:55 EST 2018
On Thu, Feb 22, 2018 at 6:21 PM, Nick Coghlan <ncoghlan at gmail.com> wrote:
> > (I wonder if the discrepancy is due to some internal interface that loses
> > the distinction between None and 1 before the decision is made whether to
> > use advanced slicing or not. But that's a possible explanation, not an
> > excuse.)
>
> That explanation seems pretty likely to me, as for the data types
> implemented in C, we tend to switch to the Py_ssize_t form of slices
> pretty early, and that can't represent the None/1 distinction.
>
> Even for Python level collections, you lose the distinction as soon as
> you call slice.indices (as that promises to return 3-tuple of
> integers).
If this is the case -- backward compatibility issues aside, wouldn't it be
very hard to fix?
Which means that should be investigated before going to far down the "how
much code might this break" route.
And certainly before adding a Deprecation Warning.
-CHB
--
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chris.Barker at noaa.gov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20180223/ab3ea60f/attachment.html>
More information about the Python-ideas
mailing list