Perl's @foo[3,7,1,-1] ?

Brian Quinlan brian at sweetapp.com
Sat Jun 13 15:44:02 EDT 2009


kj wrote:
> 
> Switching from Perl here, and having a hard time letting go...
> 
> Suppose I have an "array" foo, and that I'm interested in the 4th, 8th,
> second, and last element in that array.  In Perl I could write:
> 
>   my @wanted = @foo[3, 7, 1, -1];

Could you explain your use case? It could be that a list isn't the 
appropriate data structure.

Cheers,
Brian




More information about the Python-list mailing list