Slices objects

Alex Martelli aleaxit at yahoo.com
Fri Aug 3 04:02:57 EDT 2001


"Nadav Horesh" <Nadav at envision.co.il> wrote in message
news:mailman.996781171.15484.python-list at python.org...
> Isn't it a consistency loop-hole that slices object shortcut --- n:m:k
> is valid only in indexing expression and not elsewhere?

Not really, just a trivial syntax issue -- some colon uses might
be ambiguous if n:m:k was accepted as a slice literal anywhere,
with all variations, and if some variations were only accepted in
brackets [] you'd really have 'consistency loop-holes'.  Anyway,
built-in function slice lets you build slice objects quite easily,
anyway -- slice(n,m,k) is readable and concise (not quite as
concise as n:m:k, but arguably more readable).


Alex






More information about the Python-list mailing list