dict slice in python (translating perl to python)

bearophileHUGS at lycos.com bearophileHUGS at lycos.com
Thu Sep 11 18:28:43 CEST 2008


hofer:
> The real example would be more like:
> name,age,country = itemgetter('name age country'.split())(x) # or any
> of my above versions

That solution is very clever, and the inventor smart, but it's too
much out of standard and complex to be used in normal real code.
Learning tricks is useful, but then in real code you have to use then
only once in a while. A list comp is quite more easy to understand for
Python programmers.

Bye,
bearophile



More information about the Python-list mailing list