[Tutor] a quetion on"There should be one and preferabley one obvious way to do it"

alan.gauld@bt.com alan.gauld@bt.com
Tue, 22 Jan 2002 00:00:00 -0000


> List comprehensions replace a lot of map(lambda...) 
> garbage which is very unsightly.

I disagree. I find the map(lambda... ) form much more 
readable than the confusion that is comprehensions. 
Every time I see a comprehension I have to mentally 
rewrite it in a for loop form.

But then I spent a lot of time reading Lisp where every 
function starts like:

(define foo
   (lambda x ....))

Which is directly equivalet to:

foo = lambda x:....

in Python.

To me a map looks much cleaner than a comprehension!
(But is less flexible I think)

Maybe if comprehensions had clause delimiters somehow, like:

[x,y: for i in L: (i,i+1)]

instead of

[x, y for i in L: i, i+1]

or something...

Alan G
(Who is almost certainly in a minority of one on this! :-)