[Python-il] Fwd: Is there a Python module for handling Python object addresses?
cool-rr at cool-rr.com
Sat Sep 11 22:26:07 IDT 2010
On Sat, Sep 11, 2010 at 9:23 PM, Amit Aronovitch <aronovitch at gmail.com>wrote:
> Good question, that would indeed be bad to use short_mod.Bar as a name for
>> Foo. But the way I do my shortening does not allow for something like
>> this to happen. (I have not mentioned this in my original message, sorry.)
>> The shortening can only remove components from the address. So an address
>> like a.b.c.d.e can be shortened to a.c.d.e or a.d.e but not x.y.z. So I
>> think this prevents these kinds of problems from happening.
> Also certainly simpler than searching all of sys.modules.
> Point to consider (at the risk of being trivial): you probably want to
> consider only the "exported" names (stuff in __all__ ) to avoid accidental
> shortenings of names that were imported for internal use by a parent module
> (and might disappear from dir() if the implementation changes).
Good idea, I'll put it in a #todo. (It's not needed for my use, but would be
good to add.)
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-il