using generators for event handling in python.

R

Robin Bryce

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 !

Robin Bryce
 
R

Robin Bryce

I removed the generalised exception passing and just deal with values
and StopIteration now. fork is gone but the behaviour is not. I've
chopped down the discussion a lot and removed the twisted examples. Also
made an effort to make the source more readable.

I had a think about what I was doing and why. I think what I'm saying is
that I want to pass values into a generator and leave it to that
generator to decide how to update its local attributes (its state) if at
all. I definitely need to carefully re-read:

http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/164044


This is the version with the above changes.

http://www.wiretooth.com/python/eventhub/valuehub_recipe.html

Still trying to think of tighter example that sums everything up.

Thanks,

Robin Bryce
 
A

Alex Martelli

Robin Bryce said:
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...).


Alex
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top