Simon Brunning wrote: > On 8 Sep 2006 02:24:49 -0700, MonkeeSage <[EMAIL PROTECTED]> wrote: > > 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. > > Do you mean a name<->object mapping? > > This, I think, isn't true. There is a name->object mapping, but to > make that a name<->object mapping *would* carry an overhead. It might > (or might not) be a *small* overhead, but since every single Python > program would suffer the consequences, it's just not worth it. > Especially, as others have pointed out, that it wouldn't really be > very useful at all.
I'm new here, and I've only been using python for about 6 months; so I don't claim any deep knowledge of the inner workings of the interpreter or anything. Seemingly (and I realize that one or more of my premises may be wrong), by simple deduction, there must be a two-way name (label) to identifier mapping. I'm assuming that every object is accessed in the symbol table by a unique identifier (exposed through id()), and that every name is mapped to an identifier (some sort of heirarchy would seem to be involved in the mapping, allowing for recursive objects, multiple names for single ids, &c). Given this, some sort of look-up strategy would seem to be in place for resolving objects from identifiers, and identifiers from names. So if every name is mapped to an identifier, and every identifier is mapped to an object; given any object, one should be able to determine its identifier and all of the names associated with that identifier (if any). Obviously, that's based on several assumptions. Mabye I'm dead wrong on some points. Anyhow, I don't think it's a feature that needs to be there, or would even be useful in most cases; I just don't think it would be a big issue if it were. If I'm correct, (lack of) usefulness would be what militates against it being implemented as a core feature, not the introduction of a size or speed overhead on objects. Regards, Jordan -- http://mail.python.org/mailman/listinfo/python-list