On Dec 8, 2009, at 11:09 PM, Terry Jones wrote:

> I just wrote a fun class that lets you
> 
>   - submit jobs to be dispatched to a queue
>   - manage how many tasks are in progress at once
>   - dynamically adjust that number
>   - shut down cleanly, including
>   - recovering jobs that were queued but hadn't been dispatched

That does sound like fun!

>    # Later... send off some SMS messages.
>    dispatcher.put((2127399921, 'Hello...'))
>    dispatcher.put((5052929919, 'Test...'))

Not that this is really germane to the class in question, but, if you're going 
to be sending SMS messages, you should really represent the numbers as strings 
(well, actually, structured objects are always better, so 
PhoneNumber.fromString) because international phone prefixes sometimes - 
actually I think it would be more accurate to say "usually" - start with a zero.

>    # Later, bump up to 10 simultaneous jobs.
>    dispatcher.width = 10
> 
>    # Oops, turns out we're sending too fast, turn it down a little.
>    dispatcher.narrow(3)

This seems somewhat asymmetric.  Why are there 'widen' and 'narrow' methods if 
I can just set the 'width' attribute directly?  I could always just do '.width 
+=' and '.width -=' if I have a relative value.


_______________________________________________
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python

Reply via email to