itertools candidate: warehouse()

Raymond Hettinger vze4rx4y at verizon.net
Fri Oct 22 21:15:43 EDT 2004


[Raymond Hettinger]
> > FWIW, I prefer loading the itertools recipes so I can write:
> >
> >      repeatfunc(random.random)
> >
> > IMO, that is plainer than both the iter() and starmap() versions.

[Alex Martelli]
> I agree, but I cannot distribute Python code containing that, since the
> itertools recipes aren't part of the stdlib.

Hogwash (see below).


--- in a separate note ---
[Robert Brewer]
> But in general, I don't write scripts for my own limited use;
> I'm writing frameworks, which shouldn't depend upon little
> recipes scattered hither and yon. :/

Double hogwash ;-)

Just paste the relevant recipe in your code and be done.  No need for code
scattered hither and yon.  Just apply a pre-made solution ready for re-use.

It is not a sin to write little helper functions to make the rest of your code
more readable.  Recipes are perfect for this use because they have been tested
and refined for generic re-use.

Since when did a design pattern or code technique have to be in the standard
library to be useful?


Raymond





More information about the Python-list mailing list