Python

A dynamic programming language used heavily in the startup and scientific community.

  • Python Data Classes Are Shorthand Structs

    A Python dataclass simplifies the setup of a class with many attributes. By adding the `datacass` decorator to a `Class` you can any number of typed attributes and it will generate an `__init__` method for you with default values. This is convenient when you are modeling a data heavy application and using classes (rather than dicts) to get better type check errors.

  • Fastapi Logging in ECS Is Kafkaesque

    Getting logging to work using FastAPI in a production ECS environment is a mess of configuration and awkward interfaces. For example, there are multiple modules that interact in subtle ways: the python logging module, uvicorn, and gunicorn. Take a look at this example of the ceremony required to appease all three loggers depending on the run time—not quite the spirit of python ‘explicit over implicit’.

  • Python Type Hinting

    Python 3+ has type annotations that can be used for static type checking using a separate program. There are several competing type checkers (mypy, pyright, pyre) that can be used that are sponsored by different companies (Facebook, Microsoft).