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

lonetwin lonetwin@yahoo.com
Tue, 22 Jan 2002 12:38:48 +0530


Hi All,

On Tuesday 22 January 2002 05:30, alan.gauld@bt.com wrote:
> > 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.

  Since I came in only after list comprehension was introduced, I preferred 
it from the very beginning (over map/lambda) and here's how I read a list 
comprehension.

 [ x.func() for x in SomeList ]

 Return a list filled with x.func()'s for every element x in SomeList

 That very closely resembles the python statement (at least I think so) :)!!

   Well, but I guess it's more about how one is introduced to the construct. 
Anyways, I just wanted to say (at least for me) list comprehensions are 
readable and *very* pythonic.

:)

Peace
Steve
-- 
Lawful Dungeon Master -- and they're MY laws!