J
John J. Lee
It seems nice to do this
class Klass:
def _makeLoudNoise(self, *blah):
...
woof = _makeLoudNoise
One probably wants the above to work as if you'd instead defined woof
in the more verbose form as follows:
def woof(self, *blah): return self._makeLoudNoise(self, *blah)
It doesn't, though. Two problems:
1. In derived classes, inheritance doesn't work right:
.... def foo(s)rint 'foo'
.... bar = foo
........ def foo(s)rint 'moo'
....
2. At least in 2.3 (and 2.4, AFAIK), you can't pickle classes that do
this.
John
class Klass:
def _makeLoudNoise(self, *blah):
...
woof = _makeLoudNoise
One probably wants the above to work as if you'd instead defined woof
in the more verbose form as follows:
def woof(self, *blah): return self._makeLoudNoise(self, *blah)
It doesn't, though. Two problems:
1. In derived classes, inheritance doesn't work right:
.... def foo(s)rint 'foo'
.... bar = foo
........ def foo(s)rint 'moo'
....
2. At least in 2.3 (and 2.4, AFAIK), you can't pickle classes that do
this.
John