Skip to main content
7 events
when toggle format what by license comment
Feb 23, 2012 at 16:06 comment added Adam Parkin To clarify: I didn't mean map was frowned upon in the sense of being formally deprecated, but this article by Guido seems to indicate a certain amount of "you can use them, but you're better of doing this", which is what I meant. And FWIW, the Python style checker PyLint will actually flag calls to map as warnings, further indicating a certain "maybe you should reconsider using it" vibe.
Feb 23, 2012 at 1:46 comment added Rik Poggi (+1) And the OP could wrap tuple() around imap() if he really needs a tuple.
Feb 23, 2012 at 1:21 comment added John La Rooy @Adam, I wouldn't say it's frowned upon, but there are only a relatively few specific cases where it still makes sense to use map over list comprehensions and it takes a fair while to learn when it should be used.
Feb 22, 2012 at 23:46 comment added Adam Parkin Fun fact: the map() version above was ~50% faster than the list comp in my experiments (using timeit), and yet map is still a function that is frowned upon in the Python community.
Feb 22, 2012 at 23:07 comment added yurisich If the OP has 11 rep, I'd call it awkward too! I thought the same thing, and consulted google's python style guide to help clarify. Honestly, it didn't help much.
Feb 22, 2012 at 22:51 comment added georg Interesting how another poster considers the "awkward" code "more pythonic".
Feb 22, 2012 at 22:37 history answered Sven Marnach CC BY-SA 3.0