Some language proposals.
Aahz
aahz at pythoncraft.com
Thu Feb 26 09:54:22 EST 2004
In article <tyfoermmgp7.fsf at pcepsft001.cern.ch>,
Jacek Generowicz <jacek.generowicz at cern.ch> wrote:
>aahz at pythoncraft.com (Aahz) writes:
>> In article <tyfwu6bmfhx.fsf at pcepsft001.cern.ch>,
>> Jacek Generowicz <jacek.generowicz at cern.ch> wrote:
>>>
>>>Sure. I have some stateful methods of classes (which I create
>>>dynamically and stick onto the class as the information about the
>>>existence of the method becomes available). By implementing them as
>>>closures I can just stick them on to the class. If I were to implement
>>>them as instances then I'd have to reimplement all the descriptors
>>>that take care of turning functions into bound or unbound methods.
>>
>> Why not use callable instances?
>
>Errrrr ...
>
>Reading the paragraph you quoted and trying to understand it is left
>as an exercise to you. (Hint: it's the last sentence.)
Nope. Got nothing to do with my point:
class Callable:
def __call__(self):
print "!"
class C:
def __init__(self):
self.foo = Callable()
C().foo()
Now tell me why this doesn't do what you want.
--
Aahz (aahz at pythoncraft.com) <*> http://www.pythoncraft.com/
"Do not taunt happy fun for loops. Do not change lists you are looping over."
--Remco Gerlich, comp.lang.python
More information about the Python-list
mailing list