importing module from two packages with the same name
David Garamond
davegaramond at icqmail.com
Sun Oct 6 06:15:36 EDT 2002
Aldo Cortesi wrote:
>> /home/david/usr/lib/python/Package1/Libra.pm (1)
>> /home/david/proj/Proj1/lib/python/Package1/Scorpio.pm (2)
> Meant to be .py, right? :)
yeah, sorry. been burning the midnight oil reading and writing perl
lately :)
> The first recommendation here is, of course, is to eliminate
> your problem by refactoring your packages. If this is
> impossible, however, you may be able to do something like:
>
> sys.path.insert(0, '/home/david/usr/lib/python')
> import Package1.Libra
> reload("Package1")
> sys.path.insert(0, '/home/david/proj/Proj1/lib/python')
> import Package1.Scorpio
>
> But don't do this if you can help it.
thanks for the suggestion. i was actually thinking for "containers" to
organize my modules in a hierarchical name. e.g, there's
Internet.Mail.Message module and Internet.IRC.Server. these modules
might be developed by me or by another person, but they follow a common
topic hierarchy.
so yes, i'm looking for something like the package namespace in
perl/ruby (e.g., Net::SMTP) instead of the more "vendor-oriented" nature
of package system naming in python (e.g., ZopeCorp.Zope.Inquisition).
--
dave
More information about the Python-list
mailing list