Created
January 14, 2015 20:29
-
-
Save halfak/2a62b76b348981c28104 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> import revscores | |
>>> dir(revscores) | |
['__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__path__', '__spec__'] | |
>>> from revscores import languages | |
>>> dir(languages) | |
['Language', '__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__path__', '__spec__', 'english', 'language', 'portuguese'] | |
Notice that the first "dir()" doesn't list out langauge. This is because language is not imported by default. | |
But when we run dir() on language, we can see "english", "portuguese" and "language". This is because these modules are imported by default. | |
>>> from revscores import languages | |
>>> languages.english | |
<revscores.languages.language.Language object at 0x7f69cb053ba8> | |
So, we can just access "english" directly from the "languages" module. But we can't do the same from revscores to languages. | |
>>> import revscores | |
>>> revscores.languages | |
Traceback (most recent call last): | |
File "<stdin>", line 1, in <module> | |
AttributeError: 'module' object has no attribute 'languages' | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment