> However, this special-case approach is flawed in this example, because
> its use is so narrow. If you think about it for a minute, you
> immediately start to imagine all of the things that 'upon' ought to deal
> with that it doesn't.
> For example, it has no way to deal with error
> callbacks;

Arguably you could write :

    # Create a callback timer
    alarm = Timer()
    alarm.SetDuration( 100, Timer.Milliseconds )

    upon alarm.success:
       print "It's time to get up, silly-head!"
    upon alarm.failure:
       print "The clock is broken, you can go back to bed"

(or @upon(alarm.success) for the suggested decorator equivalent)

Which would resolve to something like :

    def _cb():
       print "It's time to get up, silly-head!"
    alarm.success.__upon__(_cb)
    def _cb():
       print "The clock is broken, you can go back to bed"
    alarm.failure.__upon__(_cb)



_______________________________________________
Python-3000 mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe: 
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com

Reply via email to