|
|
|
|
|
by gecko
5298 days ago
|
|
That's not quite right. While you're correct that lambda statements are restricted, I have never actually seen a lambda expression used to extend an object. Instead, you use a named function, which has none of these restrictions: foo = object()
foo.name = "Hi thar"
def hello(self):
print "Hello, I'm %s" % self.name
foo.hello = hello
This is, in fact, one of the reasons why the self parameter is explicit. |
|