aboutsummaryrefslogtreecommitdiff
path: root/Python.wiki
diff options
context:
space:
mode:
Diffstat (limited to 'Python.wiki')
-rw-r--r--Python.wiki30
1 files changed, 30 insertions, 0 deletions
diff --git a/Python.wiki b/Python.wiki
new file mode 100644
index 0000000..e221599
--- /dev/null
+++ b/Python.wiki
@@ -0,0 +1,30 @@
+
+== Imports are lazy ==
+
+=== main.py ===
+{{{python
+import sys
+
+match sys.argv:
+ case [prgr]:
+ print('Please give a sub-option')
+ case [prgr, 'a', *args]:
+ from a import x
+ print(f'x = {x}')
+ case [prgr, 'b', *args]:
+ from b import x
+ print(f'x = {x}')
+}}}
+
+
+=== a.py ===
+{{{python
+print('Importing a')
+x = 10
+}}}
+
+=== b.py ===
+{{{python
+print('Importing b')
+x = 20
+}}}