how do you get the name of a dictionary?

MonkeeSage MonkeeSage at gmail.com
Fri Sep 8 05:24:49 EDT 2006


Simon Brunning wrote:
> It's not inconcevable that Python could behave that way, it's just
> that it would impose an overhead on the 99.999% of Python users who
> would have no use for the feature. It's a price not worth paying.

I guess I don't get the problem with the OP's request, either. There is
already a name<->identifier mapping in place for objects. You can type
the object name and python magically gives you the object by matching
the name to the identifier. It would probably be pretty simple to
expose the name or names associated with the identifier, if any, via
built-in function or method. There would be no extra overhead. There
would be no speed hit if you didn't call the function/method. There
would be very little implementation expense (I would imagine), as the
code that is already in place to do look-ups from the parser to the
object map could probably be reused or hooked into. But seeing as it
isn't a general-purpose feature, and Steven's function would be
sufficient for most cases, I'm not saying it should be a core feature;
I'm just saying that I don't see what the big huff is about.




More information about the Python-list mailing list