|
|
|
|
|
by grot
5298 days ago
|
|
In javascript you can modify an object var foo = Object();
foo.blah = function(x,y) { ... };
But in python, that doesn't quite work. You can only do foo = object()
foo.blah = lambda x,y: ...
lambdas are a bit more limited as they are restricted to one line, and you can't have print statements, which makes complicated expressions rather ugly.edit: ah, as someone noted, the second code snippet should be something like foo = Foo() where class Foo(object):
pass
|
|