using generators for event handling in python.

Alex Martelli aleaxit at
Sat Sep 4 11:00:32 CEST 2004

Robin Bryce <robin at> wrote:

> Thanks, I don't have a compact version. I could remove the fork feature
> but I think this is pretty crucial. And I could strip the comments out.
> I definitely need to rethink the examples. I don't think any of that
> really helps express the essence though. Let me see what I can do to
> boil out the bloat.
> I've updated the link in the original post to point at a page that
> tracks the changes.
> Thankyou very much for responding !

Raymond's response is right on target (as usual).  The point is that
recipes are mostly meant as concise snippets illustrating ideas -- only
a few (say 10-15 or so, tops) of the 200+ recipes that end up in the
printed cookbook can be "modules", big chunks intended to use as such
rather than as illustrations, and they must be ones that solve key
everyday problems... of which "generators for event handling" isn't one
(examples from the 1st edition include strptime -- important enough that
it ended up in the standard library soon after the book got out!-).

Very short comments and docstrings are preferred -- the info must of
course be there, but it's intended to go in the Discussion section,
while the code of the Solution section is meant to be read mostly as
code, going to the Discussion for text.  Few people post recipes in that
way, which means we coeditors (me, David Ascher, and my wife Anna) must
do a lot of editing (so we end up biased strongly in favour of those few
recipes posted in such a way as to require less editing!-).

Do keep in mind that the deadline for 2.3-based submissions is tomorrow,
Saturday (actually this post of mine will leave on Sat -- right now I'm
without net connection...) -- then, on Sunday, Monday at the latest,
we'll take a snapshot, and only recipes that are in it will be
considered for dead-tree publication in the 2nd edition (if your recipe
is 2.4 specific the deadline is 3 weeks longer AND more likely to get in
-- we do have good coverage of most of 2.4's _language_ novelties, but
not of many of the enhancements to the standard library... the 2nd
edition will cover 2.3 and 2.4, for 2.2 and older versions people should
still refer to the 1st editiion, so good 2.4 coverage is important even
though the 2.4 release is still alpha...!)

Anyway, whatever you have (unless 2.4-specific), post it NOW or it
definitely won't get into the 2nd printed edition.  If you post now you
can edit later...  (of course, no guarantees: we have 1000+ recipes to
choose from, and can only choose the 200 or so best ones, so we WILL be
extremely selective -- much more so than in the 1st edition, when the
same number of published recipes were selected from a vastly smaller
number of posted recipes... this will presumably result in higher
quality for the 2nd edition, but also in inevitable disappointment among
authors whose recipes are _not_ selected... one tip from the horse's
mouth: if you can post a key snippet, sensibly, as a comment to a good
existing recipe, your chance of getting author credit and a free copy
zoom up -- authors of significant comments that we use in the printed
version DO get credit and a complimentary copy of the book...!!!... but
deadlines for such comments are just the same as for recipes -- tomorrow
for 2.3 stuff, 3 weeks for 2.4-specific stuff...).


More information about the Python-list mailing list