Of late, Among the Python crowd, I’ve seen that people generally dispise using map, filter and reduce. A friend was reviewing my code the other day and he’s like surprised with the number of maps with lambdas spewed across. I was reading a post on John Resig’s blog and I saw some comments by someone. My contention is, whats wrong with using map, filter and reduce (and lots of lambdas) ? I dunno thats the way I code, My friend tried to tell me that its not a good practice and I talk about how I hate Bondage and Discipline. Ok, I agree that you can use list comprehensions or generator expressions to replace map and filter. But how can you simulate reduce without getting down to loops ? Ah yeah, maybe you can mess around using iterators and generators. But isn’t reduce simpler ? C’mon folks reduce (foldl, foldr) is not just for sum() and product(), there’s a lot more to it (refer: The mapreduce paper). Just because the BDFL doesn’t like it, doesn’t mean that we need to using it. We’ll think about it when Py3k comes out
Categories
Blogroll
Posted on May 31, 2007 at 7:36 pm
Whats wrong with reduce ?
About
Recent Posts
- Setting up Scala with IntelliJ IDEA on Mountain Lion
- Installing Rosetta on Snow Leopard
- Browser toolbars and privacy
- Walled Gardens?
- Counting bloom filters in python and javascript
- A Mochikit style Dombuilder for YUI
- Tries and Ternary Search Trees in Python and Javascript
- Using redis
- A change in direction for Tagz
- Does HTML validation really matter ?
- Playing with Django Querysets
- Merging Django querysets – redux
- Looking for a Job
- tagz.in is up again
- tagz.in is down :(
Leave a Reply