I am new to python. I have a few questions coming from an armature!

Marko Rauhamaa marko at pacujo.net
Tue Aug 16 03:29:39 EDT 2016


Steven D'Aprano <steve+comp.lang.python at pearwood.info>:
> E.g. out of the following:
>> [len(x)+1 for x in sequence]
>> list(map(lambda x: len(x) + 1, sequence))
>> the first will probably be faster as well as easier to read and write.

It's mostly about idioms. Comprehensions belong to Python's core idioms,
lambdas don't.
In Scheme, I think it's the other way around. Too many Scheme
programmers are infatuated with Scheme's powerful macros and bury
Scheme's idiomatic, functional core under truckloads of foreign patterns
-- just because they can.
So use lambda in Scheme as much as you can. Avoid lambda in Python as
much as you can.
Marko


More information about the Python-list mailing list

AltStyle によって変換されたページ (->オリジナル) /