A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2004-July/046282.html below:

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

[Python-Dev] Prototypes [was: Proper tail recursion]Barry Warsaw barry at python.org
Fri Jul 16 16:14:42 CEST 2004
On Fri, 2004-07-16 at 09:33, A.M. Kuchling wrote:
> eeOn Thu, Jul 15, 2004 at 09:22:25PM -0400, Raymond Hettinger wrote:
> > 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

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

> Could function decorators be used for this?  Something like:

Possibly so, and that's kind of neat.

> @attach_to_object(Account)
> def deposit (self, v):
>     ...
> del deposit
> 
> The decorator couldn't delete the binding of 'deposit' in the current
> namespace, however.

Couldn't you play sys._getframe() tricks inside the decorator to do
this?

-Barry

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 307 bytes
Desc: This is a digitally signed message part
Url : http://mail.python.org/pipermail/python-dev/attachments/20040716/da2d4985/attachment.pgp
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4