Slices objects

Alex Martelli aleaxit at
Fri Aug 3 10:02:57 CEST 2001

"Nadav Horesh" <Nadav at> wrote in message
news:mailman.996781171.15484.python-list at
> 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).


More information about the Python-list mailing list