map, filter, reduce, zip, range, and.. slice?
Skip Montanaro
skip at pobox.com
Thu Nov 1 12:29:33 EST 2001
- Previous message (by thread): map, filter, reduce, zip, range, and.. slice?
- Next message (by thread): map, filter, reduce, zip, range, and.. slice?
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
George> Eddie's solution in the lambda notation...
George> divide = lambda x,s=1: [ x[i:i+s] for i in range(0,len(x),s) ]
...
George> Love them lambdas...
Just out of curiosity, what's the advantage you perceive of lambda over
def divide(x, s=1):
return [ x[i:i+s] for i in range(0,len(x),s) ]
in this situation?
--
Skip Montanaro (skip at pobox.com)
http://www.mojam.com/
http://www.musi-cal.com/
- Previous message (by thread): map, filter, reduce, zip, range, and.. slice?
- Next message (by thread): map, filter, reduce, zip, range, and.. slice?
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Python-list
mailing list