[Tkinter-discuss] and or ??

守株待兔 1248283536 at qq.com
Thu Aug 18 06:09:52 CEST 2011

there is a code:
from Tkinter import * 
from sys import stdout, exit                 # lambda generates a function 
widget = Button(None,                        # but contains just an expression 
             text='Hello event world',  
             command=(lambda: stdout.write('Hello lambda world\n') or exit()) ) 

when you click the button,there is output : Hello lambda world, then exit the program.
i am confused, why not use "and" ?  i made a try, if i use "or",the program will not exit ,why?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tkinter-discuss/attachments/20110818/e3000b57/attachment.html>

More information about the Tkinter-discuss mailing list