map, filter, reduce, zip, range, and.. slice?

Skip Montanaro skip at pobox.com
Thu Nov 1 12:29:33 EST 2001


    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/




More information about the Python-list mailing list