Comments on: Dynamic Method Creation in Python http://www.terminally-incoherent.com/blog/2008/06/30/dynamic-method-creation-in-python/ I will not fix your computer. Tue, 04 Aug 2020 22:34:33 +0000 hourly 1 https://wordpress.org/?v=4.7.26 By: ido http://www.terminally-incoherent.com/blog/2008/06/30/dynamic-method-creation-in-python/#comment-9498 Tue, 01 Jul 2008 08:29:42 +0000 http://www.terminally-incoherent.com/blog/2008/06/30/dynamic-method-creation-in-python/#comment-9498

you could use the hybrid version:

>>> def printf(s, *args):
... print s % args
...
>>> Person.bar = lambda p: printf("foo") if p.fname > p.lname else printf("bar")
>>> john.bar()
bar

just stick printf into a common import file, and use it whenever you need to avoid statements

oh, and I thought you would like this:
Sales Guy vs. Web Dude
http://blip.tv/file/1015028
:)

Reply  |  Quote
]]>