- Learn Python the Hard Way
- Codecademy: Python Courses & Tutorials
- Google's Python Class
- Interviewbit: Python Course
Notes from Jaimie Murdock:
Assumes a start with Python 3.6. Python 2.7 is end of life in 2020, so new projects should avoid it.
PEPs (Python Enhancement Proposals) are how new features are added to the language and are very useful for learning why things are the way they are.
Some also offer style guidance.
- Coding style
- Lists, iterators, and generators
- PEP 202 -- List Comprehensions
- PEP 275 -- Dict Comprehensions
- PEP 234 -- Iterators
- PEP 255 -- Simple Generators
- PEP 289 -- Generator Expressions -- most of the time a list comprehension can be done as a generator when passed as an argument, as long as the calling function doesn't need the
len()
of the list. This improves memory usage. - PEP 279 -- The enmerate() built-in function
- Syntax
- PEP 343 -- The "with" statement -- really great way to make sure files are closed when done being read.
- PEP 498 -- Literal String Interpolation --
f
-strings, requires Python 3.6
- General
collections
-- especiallydefaultdict
, which helps avoidKeyError
issues when populating a collectionpickle
-- Python-native serialization. For export, better practice to use JSON viajson.dump(obj)
, but useful when in-memory objects take a long time to build.re
- Script Management
- Web
- Threading and Process Management
- Testing
unittest
unittest.mock
-- super useful for injecting fake-responses from HTTP servers for testingcoverage.py
--pip install coverage