"Lenny G." <alengarbage at yahoo.com> 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
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4