Self function

Luis Zarrabeitia kyrie at uh.cu
Tue May 5 08:33:01 EDT 2009


On Tuesday 05 May 2009 02:46:58 am Chris Rebert wrote:
> <devils_advocate>
> Adding syntax is EVIL(tm) for it angers the Gods of Backwards
> Compatibility, and this proposal is completely unnecessary because you
> could instead just write:
[...]
> And there would be much clashing with existing variable names,
> for keywords are the Devil's work!
> </devils_advocate>

Heh. I liked the proposal (though I'm not 100% sold on the name __this__), and 
one of the reasons I liked it was... it preempted the name-clashing argument. 
Not a new keyword, just a variable that is injected on the local namespace, 
so it would only clash with code that uses __this__ as a global (or that 
expects to use an unbound __this__).

Btw, is there any way to inject a name into a function's namespace? Following 
the python tradition, maybe we should try to create a more general solution!

K.

(P.S: there is one advantage on having it as a keyword, though: it would make 
static analisis easier)

-- 
Luis Zarrabeitia (aka Kyrie)
Fac. de Matemática y Computación, UH.
http://profesores.matcom.uh.cu/~kyrie



More information about the Python-list mailing list