Tuesday, 15 April 2014

python 3.x - Using lambda to describe always upto-date attitude of an object -



python 3.x - Using lambda to describe always upto-date attitude of an object -

as part of reply on code golf game sis site, used lambda function returned number of newlines nowadays in string, so:

newlines = lambda v: len([n n in v if n=='\n'])

this used in farther list comprehension provide up-to-date reply regarding chosen string, , used determine status test i.e. letter compare against, illustration hypothetical code:

string += letter if letter in [[a, b, ... y, z,], '\n'][newlines(string)] else none

my query whether considered standard , acceptable method of using lambda, or whether method more conventional.

python-3.x lambda

No comments:

Post a Comment