News for hackers. Stuff that matters.
Re:Evolution of a Python programmer by notaddicted on Friday January 29, 2010 @03:49PM (#1087522)
I'm constantly fighting an internal battle between functional programming and being more pythonic.

For example: I once rolled my own lisp style immutable list type using nested tuples, i.e. (1,(2,(3,None))) for a problem that they were particularly well suited. (http://en.wikipedia.org/wiki/Knapsack_problem#0-1_knapsack_p...) and got about a 10% speedup. In the end though I threw it out because it was far too ugly.

But I always prefer a def and a map to a for loop.

Re:Evolution of a Python programmer by rbanffy on Friday January 29, 2010 @08:02PM (#1088005)
"But I always prefer a def and a map to a for loop."

For those I either go with a list comprehension or a generator expression.

Re:Evolution of a Python programmer by jordanb on Saturday January 30, 2010 @12:12AM (#1088291)
^-- Hear hear.

I started getting pretty deep into the functools until I discovered list comprehensions and generators. You get all the concise goodness of the functools while remaining Pythonic. The list comprehension is a really good, intuitive syntax too, I think.