Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!news-out.readnews.com!transit3.readnews.com!panix!not-for-mail From: Grant Edwards Newsgroups: comp.lang.python Subject: Re: Converting a list of strings into a list of integers? Date: Mon, 23 Jul 2012 14:27:19 +0000 (UTC) Organization: PANIX Public Access Internet and UNIX, NYC Lines: 27 Message-ID: References: <3rCdnUCiWpP1gZHNnZ2dnUVZ7vQAAAAA@giganews.com> NNTP-Posting-Host: dsl.comtrol.com X-Trace: reader1.panix.com 1343053639 23979 64.122.56.22 (23 Jul 2012 14:27:19 GMT) X-Complaints-To: abuse@panix.com NNTP-Posting-Date: Mon, 23 Jul 2012 14:27:19 +0000 (UTC) User-Agent: slrn/pre1.0.0-18 (Linux) Xref: csiph.com comp.lang.python:25877 On 2012-07-22, Jan Riechers 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!!