Browse Source

Imports

pull/115/head
Jure Šorn 3 years ago
parent
commit
cae27c1fb3
2 changed files with 8 additions and 6 deletions
  1. 5
      README.md
  2. 9
      index.html

5
README.md

@ -817,8 +817,9 @@ import <module> # Imports a built-in or '<module>.py'.
import <package> # Imports a built-in or '<package>/__init__.py'.
import <package>.<module> # Imports a built-in or '<package>/<module>.py'.
```
* **Package is a collection of multiple modules, but it can also define its own objects. Python treats any directory containing a file called `'__init__.py'` as a package.**
* **Running `'import <package>'` does not automatically provide access to package's modules unless they are imported in its init script.**
* **Package is a collection of modules, but it can also define its own objects.**
* **On a filesystem this corresponds to a directory of Python files with an optional init script.**
* **Running `'import <package>'` does not automatically provide access to the package's modules unless they are explicitly imported in its init script.**
Closure

9
index.html

@ -226,7 +226,7 @@ pre.prettyprint {
<body>
<header>
<aside>October 15, 2021</aside>
<aside>October 16, 2021</aside>
<a href="https://gto76.github.io" rel="author">Jure Šorn</a>
</header>
@ -847,8 +847,9 @@ creature = Creature(point, direction)
</code></pre></div>
<ul>
<li><strong>Package is a collection of multiple modules, but it can also define its own objects. Python treats any directory containing a file called <code class="python hljs"><span class="hljs-string">'__init__.py'</span></code> as a package.</strong></li>
<li><strong>Running <code class="python hljs"><span class="hljs-string">'import &lt;package&gt;'</span></code> does not automatically provide access to package's modules unless they are imported in its init script.</strong></li>
<li><strong>Package is a collection of modules, but it can also define its own objects.</strong></li>
<li><strong>On a filesystem this corresponds to a directory of Python files with an optional init script.</strong></li>
<li><strong>Running <code class="python hljs"><span class="hljs-string">'import &lt;package&gt;'</span></code> does not automatically provide access to the package's modules unless they are explicitly imported in its init script.</strong></li>
</ul>
<div><h2 id="closure"><a href="#closure" name="closure">#</a>Closure</h2><p><strong>We have a closure in Python when:</strong></p><ul>
<li><strong>A nested function references a value of its enclosing function and then</strong></li>
@ -3016,7 +3017,7 @@ $ pyinstaller script.py --add-data '&lt;path&gt;:.' <span class="hljs-comment">
<footer>
<aside>October 15, 2021</aside>
<aside>October 16, 2021</aside>
<a href="https://gto76.github.io" rel="author">Jure Šorn</a>
</footer>

Loading…
Cancel
Save