My own 12 points list
Hannu Kankaanpää
hanzspam at yahoo.com.au
Tue Aug 26 14:33:38 EDT 2003
pruebauno at latinmail.com (nnes) wrote in message news:<d8778a53.0308251600.143ec0a3 at posting.google.com>...
> I have really no mayor gripes, and the few things I would change would
> break backward compatibility, but here is the list anyway:
>
> 2.) Eliminate map (), filter (), reduce (). It can be replaced with
> list comprehensions and for loops, which are easier to read.
How do you pass a list comprehension to a function? With map
as a function, you could do something wicked like
do_something_wicked([map, my_map, his_map])
Where my_map and his_map are alternative implementations for
map, and do_something_wicked would use all those functions
for something crazy. But sure, map could be implemented with
list comprehensions if it was really needed, probably like this:
def map(fn, *lists):
return [fn(*args) for args in zip(*lists)]
Soo.. Do I have an optinion? Maybe, maybe not.. I just wanted
to point out that some things are useful as being functions
instead of plain syntax.
> 4.) Eliminate xrange(), replace range() with xrange() implementation
Then people would have to use list(range[10]) to get the list when
needed.. I always use range() since Psyco seems to optimize it
to a simple for loop of integers (on my tests with Psyco,
"for x in range(n)" is -faster- than "for x in xrange(n)"!).
So xrange() could be removed, and then people would just rely
on JIT compiler optimizations to do the right thing.
Maybe not yet though.
> 6.) Eliminate lambda, use local ?def somename(param):return expr'
> instead.
Noo, lambda is so lovely and compact. It only obfuscates on
the purposedly obfuscated code. It's too long word for my taste
though.. A symbol for it would be better (I'm not joking).
More information about the Python-list
mailing list