Hi all, It's obvious how to use LC's to replace map and filter, but what about reduce? It is one of my favorite functions.
>>> time=1901248 >>> reduce(lambda a, b: a[:-1] + [a[-1]%b, math.floor(a[-1]/b)], [[time], 60, 60, 24]) [28, 7.0, 0.0, 22.0] # secs, mins, hrs, days Nicholas -- http://ntung.com
_______________________________________________ Python-3000 mailing list Python-3000@python.org http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com