From f4a0bb7dc43ee70e02a66475d3f6c5c52f436262 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Wed, 22 Jun 2022 15:19:24 +0200 Subject: ons 22 jun 2022 15:19:24 CEST --- Python.wiki | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 Python.wiki (limited to 'Python.wiki') 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 +}}} -- cgit v1.2.3