[Python-Dev] Prototypes [was: Proper tail recursion]

Raymond Hettinger python at rcn.com
Fri Jul 16 04:43:27 CEST 2004


[Raymond]:
> > > helping out people who want to experiment with prototype OO.  The
> > > request is make it possible to write:
> > >
> > >     def Account.deposit(self, v):
> > >         self.balance += v

[Barry]
> I've wanted this for a long time, but I don't think Guido's ever been
in
> favor of this.

Every now and then he gives a little gift if it makes us happy, benefits
a class of users, and doesn't muck up anything else. 



[AMK]
> > Could function decorators be used for this?

[Barry]
> Possibly so, and that's kind of neat.

Perhaps, but why make something hard out of something simple.  Regular
assignments show that no special magic is required:  acct.bal = 0.  The
def statement could benefit from the same courtesy.



Raymond



More information about the Python-Dev mailing list