Agenda: Python Advanced (2023-04-24 - 2023-04-26)¶
Up Front: Project Management¶
Day 1: Python Inside Out¶
Exercise Prerequisites¶
References And Other Pitfalls¶
Looping Constructs (With An Emphasis On The else
Clause)¶
Generators¶
Closures, Decorators And More¶
Dynamic Features¶
Object Oriented Programming¶
From Object Oriented Programming …
Error Handling And Recovery¶
Miscellaneous Threading¶
Show how the load/modify/store conflict appears to not be an issue in Python (?) (
code/race-load-modify-store.py
)Could that be the GIL
What’s the GIL altogether?
Why could it be a bad idea to trust the GIL too much? (⟶ PEP 703)
Jason Brownlee mentions the same “issue” – there is no race condition. There used to, he says, before Python 3.10, but nowadays there’s not. He shows an contrived way to show a race (involving a
time.sleep(0)
🙄)Fix that with a mutex (show
with
usage!)Events. Maybe some live-hacked dice-rolling in a subthread.
Multiprocessing
Simply walk through the introductory example in multiprocessing — Process-based parallelism
Day 2: Clean Code (In A Broader Sense), Group Project Kickoff¶
Group Project: Discussion¶
Data acquisition: gathering sensor data
Varying kinds of sensors: physical hardware, internet proxy, MQTT, …
Varying kinds of information sinks: CSV, database, MQTT, …
Acquisition machinery: timestamping, frequency, buffering, …
Clean Code?¶
From Is Software A Craft? Software Is A Craft! ⟶ Clean Code …
Design Patterns Overview¶
Design patterns: problems, possible solutions
Test Driven Development¶
(Try to) establish mindset
pytest
fixtures
Day 3: Group Project¶
Create two or three teams
Use Test Driven Develpment (TDD) to formulate requirements
Loop: hack, fix, refactor