String representation of an identifier's name

Boethius boethius at
Sun Jan 12 22:34:47 CET 2003

I think it easier to explain with an example, so here it goes:
Assuming there's a function fn that does what I want, it would work like this:

g = 23
foo = {'a':56}

fn(g) => 'g'
fn(foo) => 'foo'

How can I write fn? O:-)

More information about the Python-list mailing list