print statement in lambda expression

Michael P. Soulier msoulier at mcss.mcmaster.ca_.nospam
Sat Feb 2 22:14:53 EST 2002


    Hello people. 

    I just recently found that I couldn't put a print statement in a lambda
expression as a binding in Tk. Could someone explain why? 

    ie.
    
    b1 = Button(frame, text="Message", command=lambda: print "message")

    If I replace print with sys.stdout.write, it works fine. I don't follow
why. 

    Thanks,

    Mike

-- 
Michael P. Soulier <msoulier at mcss.mcmaster.ca>, GnuPG pub key: 5BC8BE08
"...the word HACK is used as a verb to indicate a massive amount
of nerd-like effort."  -Harley Hahn, A Student's Guide to Unix



More information about the Python-list mailing list