Stubbing function
Charles G Waldman
cgw at fnal.gov
Fri Jan 14 13:42:08 EST 2000
Timothy Grant writes:
> Is there a "standard" method of stubbing functions in Tkinter?
>
> I would like to be able to use the "command=lambda:????" construct to
> stub my functions as I don't like creating functions with empty bodies
> just for stubbing purposes. I tried "command=lambda: pass" and that
> generated syntax errors, so I know that I'm missing something basic
> about how lambdas work, I just don't quite know what!
Note that
lambda: None
works just fine.
lambdas may not contain any statements, just functions and
expressions. For instance:
lambda x: print x
is illegal, wheras
lambda x: sys.stdout.write("%s\n"%x)
is allowed.
Hope this helps,
-cgw
More information about the Python-list
mailing list