Accessing func_name from inside a function

Ben Finney bignose+hates-spam at benfinney.id.au
Sat Mar 25 19:19:36 EST 2006


"James Thiele" <jamesthiele.usenet at gmail.com> writes:

> I'd like to access the name of a function from inside the function.

A function, like most other objects in Python, can have any number of
names bound to it without the object being informed. Any of those
names can then be used to reference the object, and the object has no
way of knowing by what name it was referenced.

Because of this fallacy, it's generally considered bad programming
style to want to know "the" name of the current object from inside
that object.

What is it you're trying to achieve?

-- 
 \     "Unix is an operating system, OS/2 is half an operating system, |
  `\       Windows is a shell, and DOS is a boot partition virus."  -- |
_o__)                                                  Peter H. Coffin |
Ben Finney




More information about the Python-list mailing list