Office Hours Topics
Core Python Concepts
- Pass by Value / Pass by Reference
- Global variables
- Positional and keyword arguments
- Default parameters
- Guard clauses - what they are and why they’re useful
isinstance()- Truthiness,
isvs.==, and when to use!=vs.not - Useful built-in functions (
zip,map,any,all, etc.) - Useful Python libraries (e.g.
datetime, NumPy, Pandas) - Big O complexity
- Queues and stacks
while Trueloopsexec()andeval()- Regex (when, why, how to use)
- Type hints (including more complex forms like
list[str])
Functions & Program Structure
- Lambda functions and when to use them vs. regular functions
- Iterators and generators
- Decorators
- Dictionaries and dict comprehensions
- List comprehensions
- Classes and objects (
self, creating your own classes, arguments within methods) - What is an
if __name__ == "__main__"block? - Creating a
main()function
Error Handling & Logging
try-exceptblocks and best practices for error handling- Raising errors manually
printvs.logging
Testing in Python (pytest & best practices)
- Best practice for unit testing
pytest.raisesand testing for exceptions- Test parametrisation
- Organising and grouping test cases (classes vs. markers)
- Can/should you have multiple assertions in one test?
- How to use
pytestoptions (-k,-vv) - Monkeypatch and capsys (uses, examples, input/output testing)
- Testing custom options with
argparse - Different testing approaches for functions that output
Noneor booleans - Identifying different test cases (normal, extreme, erroneous)
- Best approach for writing tests for logic bugs across multiple functions
- How to use
pytestlike a pro
Code Style & Readability
- Docstrings and code comments (best practices, guidelines, readability)
- Best practice for naming variables
- Best practices for blank lines and code readability
- Conventions for string quotes (
'vs.")
Environment & Imports
- Virtual environments (how they work, permanence, moving/deleting)
- Relative vs. absolute imports
Version Control (Git & GitHub)
.gitignore- Forking, cloning, pushing, branching vs. committing
- Git pull options
- Building and running a cloned repo with binaries
- Why enable workflows after forking
- Commit messages (how detailed, good commit-to-push ratio, industry prefixes)
- When to commit code (beyond end of session)
- Additional documentation when completing projects (clients, projects)
Developer Workflow & Tools
- Best practice for debugging code
- Bash aliases and terminal shortcuts
- Slack markdown (code blocks, snippets, links)
- How to format code in Slack messages