On Sat, Sep 11, 2010 at 9:23 PM, Amit Aronovitch <[email protected]>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). > > AA >
Good idea, I'll put it in a #todo. (It's not needed for my use, but would be good to add.) Ram.
_______________________________________________ Python-il mailing list [email protected] http://hamakor.org.il/cgi-bin/mailman/listinfo/python-il
