On 11/17/06, Talin <[EMAIL PROTECTED]> wrote:
>     # Create a callback timer
>     alarm = Timer()
>     alarm.SetDuration( 100, Timer.Milliseconds )
>
>     upon alarm:
>        print "It's time to get up, silly-head!"
>
>     print "Alarm has been set!"


Why invent a new special case syntax - the ones we have work fine.

# This goes in a library
def upon(event):
    def wrapper(fn):
        event.set_callback(fn)
        return fn
    return wrapper

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

@upon(alarm)
def callback():
    print "It's time to get up, silly-head!"

Looks pretty readable to me...

Paul
_______________________________________________
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