[Python-Dev] the explicit self (original) (raw)
Georg Brandl g.brandl at gmx.net
Wed Aug 27 09:47:10 CEST 2008
- Previous message: [Python-Dev] the explicit self
- Next message: [Python-Dev] the explicit self
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Kilian Klimek schrieb:
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
Just a note about the patch: it introduces the implicit "this" by injecting it into the function's globals. Due to how Python looks up globals and locals, this will be much slower than having a local called "self".
Georg
- Previous message: [Python-Dev] the explicit self
- Next message: [Python-Dev] the explicit self
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]