Slicing beyond list -- bug or featurette?
Ivan Van Laningham
ivanlan at callware.com
Fri Jul 2 18:22:10 EDT 1999
Hi All--
Pierre Fortin wrote:
>
> Just ran into a situation which can be summarized as follows:
>
[bobbitt]
> list[2:50] returns [ 2,3,4 ]
> list[20:] or list[20:30] returns []
>
> Can I count on this, or should I code try/except for the day it's
> fixed? This 'feature' reduces the error situations; but is it
> correct/intended?
>
I don't presume to speak for Guido, but the way slicing is implemented
it seems likely that you can count on it: list[:] is implemented as if
it were list[0:MAXINT]. I doubt that Guido will change it, but then,
the Guido is the Guido.
<but-they-don't-call-him-guido-svetz-for-nothing>-ly y'rs,
Ivan;-)
----------------------------------------------
Ivan Van Laningham
Callware Technologies, Inc.
ivanlan at callware.com
ivanlan at home.com
http://www.pauahtun.org
See also:
http://www.foretec.com/python/workshops/1998-11/proceedings.html
Army Signal Corps: Cu Chi, Class of '70
----------------------------------------------
More information about the Python-list
mailing list