FAQ

Glenn Andreas wrote:
Also, limiting to "one per expression" prevents you from doing something
like:

myHandlers = {
"click" : def(x,y):
print "click at x,y"
"enter" : def():
print "mouse entered"
"exit" : def():
print "mouse exited"
}
I just thought of a better way to write this.

myHandlers = {}
myHandlers["click"] = def(x,y):
print "click at x,y"
myHandlers["enter"] = def():
print "mouse entered"
myHandlers["exit"] = def():
print "mouse exited"

I think that's pretty nice.

Shane

Search Discussions

Discussion Posts

Previous

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 16 of 23 | next ›
Discussion Overview
grouppython-list @
categoriespython
postedMar 24, '04 at 9:58p
activeMar 27, '04 at 12:58a
posts23
users7
websitepython.org

People

Translate

site design / logo © 2022 Grokbase