kj <no.em...@please.post> writes: > But in the immediate term, cusum is not part of the standard library. > > Where would you put it if you wanted to reuse it? Do you create > a module just for it? Or do you create a general stdlib2 module > with all those workhorse functions that have not made it to the > standard library? Or something else entirely?
In a typical application you'd have a bunch of such utility functions in a single "utils.py" module or something like that. Java programs use separate files for each class, so you get zillions of files, but Python users tend to put more code in each file. As for the stdlib, the natural places for such a function would be either itertools or functools, and the function should probably be called "scan", inspired by this: http://en.wikibooks.org/wiki/Haskell/List_processing#Scans Python's version would be like "scanl" with an optional arg to make it like "scanl1". -- http://mail.python.org/mailman/listinfo/python-list