"Lenny G." <[EMAIL PROTECTED]> wrote: > Suppose I have a python module named Hippo. In the Hippo module is a > class named Crypto. The Crypto class wants to 'from Crypto.Hash import > SHA' which refers to the module/classes in python-crypto. Other > classes in the Hippo module want to 'import Crypto' referring to > Hippo.Crypto. > > How do I do this? For now, I just renamed my Hippo.Crypto to > Hippo.HippoCrypto and everything is okay as long as I use 'HippoCrypto' > to refer to that class. But, this is of course redundant. What I > really want to do is use > > 'import Crypto' # to refer to python-crypto > 'import Hippo.Crypto' # to refer to Hippo.Crypto > > but the 2nd item doesn't seem to work from within the Hippo module. > What am I missing?
The (optional) renaming of the imported modules/classes I would guess: # Hippo.py import Crypto as PythonCrypto class Crypto: pass h1 = PythonCrypto.Hash h2 = Crypto.Hash # refers to Hippo.Crypto HTH, George -- http://mail.python.org/mailman/listinfo/python-list