On 2012-07-22, Jan Riechers <janpet...@freenet.de> wrote: > I am not sure why everyone is using the for-iterator option over a > "map", but I would do it like that: > > MODUS_LIST= map(int, options.modus_list) > > "map" works on a list and does commandX (here "int" conversion, use > "str" for string.. et cetera) on sequenceY, returning a sequence. More > in the help file.
"map" is what comes to mind first for me, but that's probably because 1) Before I learned Python, I learned other more functional languages where map was the definitive answer. 2) When I first learned Python it didn't have list comprehensions. That said, "map" seems to be frowned upon by the Python community for reasons I've never really understood, and most people are going to prefer reading a list comprehension. "What most people are going to prefer reading" does matter... -- Grant Edwards grant.b.edwards Yow! ... the MYSTERIANS are at in here with my CORDUROY gmail.com SOAP DISH!! -- http://mail.python.org/mailman/listinfo/python-list