Accessing func_name from inside a function

Alex Martelli aleaxit at yahoo.com
Sun Mar 26 23:17:18 CEST 2006


Ron Adam <rrr at ronadam.com> wrote:

> A "Current" key word would fix this.  Or possibly "This" which would be
> short for "This object".

I think "This" would cause huge confusion, since in other popular
language the keyword "this" means (a pointer/reference to) "the instance
variable on which the method is being called" -- my use is instead for
"the object of the immediate lexically enclosing scope" (a module,
class, or function).  Implementation wouldn't be trivial in today's
CPython, anyway: frames have no references at all to function objects
(only to _code_ objects), and class objects don't even exist untill well
after their top-level code has long finished running; to make Current
possible, these subtle points of semantics would have to be changed in
quite a revolutionary way, especially where classes are concerned.


Alex



More information about the Python-list mailing list