array slice of [:-0] ??

guthrie guthrie at mum.edu
Tue Jul 18 11:11:42 EDT 2006


Thanks all!!
---------------------

guthrie wrote:

> Beginner question! :-)
> 
> x=[1,2,3,4]
> for i in range(len(x)):
>    print x[:-i]
> 
>  >>> []
>  >>> [1,2,3]
>  >>> [1,2]
>  >>> [1]
> 
> 1) The x[:-0] result seems inconsistent to me;
>     I get the idea that -0=0, so it is taken as x[:0] -> []
> 2) how then should one do this basic left-recursive subsetting (easily).
> 
> Thanks.
> 


----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----



More information about the Python-list mailing list