2012-01-08

mapBetween

http://blog.livedoor.jp/dankogai/archives/51763038.html
より、mapBetweenのPython実装。

def mapBetween(lis,func=lambda x,y:x+y):
    try:
        return map(func, lis[:-1], lis[1:])
    except TypeError:
        print 'func should be a binary operator'
        return

No comments:

Post a Comment