[Tutor] Should this be a list comprehension or something?

Terry Carroll carroll at tjc.com
Fri Jan 28 19:15:33 CET 2005


Sorry for not responding earlier to thank all the people who weighed in on 
my question.  I'm glad to find that my first take on it was sufficiently 
pythonic.

Alan, I'd never seen the criterion befor that list comprehensions should 
be used to generate other lists.  That's helpful, and I'll keep it in 
mind.

Thanks to Max and Tony for their comments and tests on efficiency.  
Although I was primarily interested in finding out if I was thinking in 
the right way, this was helpful.

Karl, I hadn't thought about overloading, although I knew about the 
possibility.  That's really cool, and quite clear.

Sean, I wasn't even aware of reduce() before.  Thanks, I'll look into 
that.






More information about the Tutor mailing list