aboutsummaryrefslogtreecommitdiff
path: root/Python.wiki
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2022-06-22 15:19:24 +0200
committerHugo Hörnquist <hugo@lysator.liu.se>2022-06-22 15:19:24 +0200
commitf4a0bb7dc43ee70e02a66475d3f6c5c52f436262 (patch)
tree6b02d13b1ab68989df6fd350eed7dfd3266bc68f /Python.wiki
parentons 15 jun 2022 03:28:03 CEST (diff)
downloadwiki-public-f4a0bb7dc43ee70e02a66475d3f6c5c52f436262.tar.gz
wiki-public-f4a0bb7dc43ee70e02a66475d3f6c5c52f436262.tar.xz
ons 22 jun 2022 15:19:24 CEST
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
+}}}