>
> Unlike Perl, Python is based upon the principle of having exactly one
> way to do each thing.
> List comprehension (the [arr[x] for x in [1,6,9] ] method) is one way to
> accomplish the goal, and it is reasonably parsimonious.  Therefore, it
> is very unlikely to have another method of accomplishing the same.
>

There is another method, but I wouldn't call it elegant.
It ought to be more efficient, though.

map(arr.__getitem__, (1,6,9))
_______________________________________________
Python-il mailing list
[email protected]
http://hamakor.org.il/cgi-bin/mailman/listinfo/python-il

לענות