-
- Set up HEPA purifier.
- Finalized v2 charcoal triple rise garden. Only items I may consider ordering in a later seed batch: 2 more nurseries (to total 9) and v2 caps (square extrusion).
- Superbowl.
- Aquarium maintenance.
- Equinox etc.
- SBSC. Typing.
- Reread all the docs to freshen up.
- Remember that an
alias
is a custom collection of other types. A NewType
is a custom subclass of another type.
- Pep589 for
TypedDict
, a great structure that is still a dict at runtime but allows types for specific keys: https://peps.python.org/pep-0589/
- Remember that python uses inference on your code to determine type. This is called (static) duck typing, but the official docs call it “structural subtyping”. It just means that you don’t have to put annotations on EVERY param/arg/return/member/var (nominal subtyping) – it can infer it whenever obvious, and will flag when unknown.
- Wrote a bit for instantiating type aliases. Long story short: don’t do it.
- I imagine they’ll fix this in a future release, just like they did with allowing subscription within the builtins, rather than shipping a bunch of generics with the typing module to mirror the containers.
- It would be really nice to define the (nested) type interface and then just instantiate from that.
- I guess the rationale is that they want us to define our own custom generic classes for these cases, and then instantiate those classes (all instead of type aliases + subscription), because then instantiation becomes clear (and we’re working in the realm of runtime code instead of types).
Num = int | float
is possible, but I like the explicit version without the alias much better.
- Notes on the ticket for TypeVars (define/reference) and Generics (scoping). Also invariance, covariance, contravariance: https://peps.python.org/pep-0483/#covariance-and-contravariance and https://peps.python.org/pep-0484/#covariance-and-contravariance
- Revisited ParamSpec, Callable, and Concatenate. All useful type features for decorators.