Articles
Software
Gallery
Other works
Contacts

#Intuitiv python module tl;dr.html



        { @begin=sh@
            $ tree
            .
            ├── main.py
            ├── mymodule.py
            └── mypackage
                └── mypackagedmodule.py

            2 directories, 3 files
            $ for i in **/*.py; do
                bat $i
            done
            ───────┬────────────────────────────────────────────
                   │ File: main.py
            ───────┼────────────────────────────────────────────
               1   │ import mymodule
               2   │ import mypackage.mypackagedmodule as mpm
               3   │
               4   │ mymodule.f()
               5   │ mpm.f()
            ───────┴────────────────────────────────────────────
            ───────┬────────────────────────────────────────────
                   │ File: mymodule.py
            ───────┼────────────────────────────────────────────
               1   │ def f():
               2   │     return 0
               3   │
               4   │ if __name__ == '__main__':
               5   │     print("heyo")
               6   │ else:
               7   │     print("I am a module.")
            ───────┴────────────────────────────────────────────
            ───────┬────────────────────────────────────────────
                   │ File: mypackage/mypackagedmodule.py
            ───────┼────────────────────────────────────────────
               1   │ def f():
               2   │     return 1
            ───────┴────────────────────────────────────────────
            $ python main.py
            I am a module.
            $ python mymodule.py
            heyo
        @end=sh@ }