[Python-Dev] the explicit self (original) (raw)

Michael Foord fuzzyman at voidspace.org.uk
Wed Aug 27 10:21:08 CEST 2008


Maciej Fijalkowski wrote:

You can provide selfless class as a class with special metaclass that overloads new and changes signature of each method. Not sure how good is this, but requires no changes to the language and will work as you want.

Are you advocating this Maciej? ;-)

There's an example that does this here:

http://www.voidspace.org.uk/python/articles/metaclasses.shtml#the-selfless-metaclass

Michael

Cheers, fijal

On Wed, Aug 27, 2008 at 8:46 AM, Kilian Klimek <kilian.klimek at googlemail.com> wrote:

Hello,

i know this has been discusses very much, i'm sorry, but i can't help it. In a nutshell, the proposal is as follows: 1. Self remains explicit (like it is now). 2. if a class is a subclass of a special class, e.g. named 'selfless', the self parameter is not required and a special variable, named 'this' is provided.

For example: class Foo (selfless): def init (x, y): this.x = x ... A patch for 3.0b3 implementing this can be found at http://www-lehre.inf.uos.de/~kklimek/misc/pythonslp8.diff regards, Kilian Klimek


Python-Dev mailing list Python-Dev at python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/fijall%40gmail.com


Python-Dev mailing list Python-Dev at python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/fuzzyman%40voidspace.org.uk

-- http://www.ironpythoninaction.com/ http://www.voidspace.org.uk/ http://www.trypython.org/ http://www.ironpython.info/ http://www.resolverhacks.net/ http://wwww.theotherdelia.co.uk/



More information about the Python-Dev mailing list