Python Basics (2023-05-15 - 2023-05-17)¶
Day 1¶
Setup¶
Basics¶
Datatypes¶
Control Flow, Sequences, Iteration¶
More Datatypes¶
Day 2¶
Morning Awakening¶
Generators¶
Generating infinitely many Fibonacci numbers: fibonacci.py
Generating a sine wave: sine.py
Watching a directory for new files (by iterating): watch-dir.py
A Bit Of venv
, A Bit Of pip
¶
Basics¶
More Datatypes¶
Exercise Series: CSV Files¶
Exercise: Read CSV File (csv.reader) (solution: read-userdb-noheader.py)
Exercise: Read CSV File (csv.dictreader) (solution: read-userdb-header.py)
Exercise: Refactoring - Extract CSV Reading Into Function (csv.reader) (solution: read-userdb-noheader-func.py)
Exercise: Refactoring - Extract CSV Reading Into Function (csv.dictreader) (solution: read-userdb-header-func.py)
Exercise: Refactoring - Extract Both CSV Formats Into Module (solution: userdb_csv.py (module), read-userdb-noheader-mod.py, read-userdb-header-mod.py)
Day 3¶
Object Oriented Programming¶
From Object Oriented Programming
(livehacked in oo.py)
Interleaved by a pytest
installation into a virtual environment:
Followed by an exercise …
OO, cont’d …
(see also oo.py)
Advanced Language Features¶
Context Managers: The with Statement (livehacked - though the topic is a better read - in context-manager.py)
Links¶
Beginner¶
Python Tutorial for Beginners 4: Lists, Tuples, and Sets, by Corey Schafer
Python Tutorial for Beginners 5: Dictionaries - Working with Key-Value Pairs, by Corey Schafer
10 Python Tips and Tricks For Writing Better Code, by Corey Schafer
Python Tutorial: Using Try/Except Blocks for Error Handling, by Corey Schafer
Modules from Standard Library¶
Python Tutorial: OS Module - Use Underlying Operating System Functionality, by Corey Schafer
Python Tutorial: Calling External Commands Using the Subprocess Module, by Corey Schafer
Python Tutorial: re Module - How to Write and Match Regular Expressions (Regex), by Corey Schafer
Python Tutorial: CSV Module - How to Read, Parse, and Write CSV Files, by Corey Schafer
Advanced¶
NumPy and Data Science Tutorials¶
Conference Talks¶
Built in Super Heroes. David Beazley in an entertaining keynote to the “PyData Chicago 2016” conference. He has a number of very good and entertaining (and very advanced) videos. You have to spend an entire evening with him though.
Keynote - David Beazley. David Beazley live coding a Web Assembly interpreter. PyCon India 2019.
David Beazley: Generators: The Final Frontier - PyCon 2014: David Beazley again a bit (a whopping four hours) more precise on that topic.