B
Bruno Desthuilliers
Evan Klitzke a écrit :
....Traceback (most recent call last):
File "<stdin>", line 1, in ?
Indeed. But even with OO, explicit is better than implicit.
.... print foo.cSort of. Functions are objects in python, so you can set attribute on them. E.g.
def foo():
return foo.c
foo.c = 1
print foo()
....Traceback (most recent call last):
File "<stdin>", line 1, in ?
File said:Which will print 1. Of course, it would generally be better to write
your own class for this sort of thing, so that you can set the
variable in the instance scope.
Indeed. But even with OO, explicit is better than implicit.