Just Use Dictionaries (Python)

  • I used to be a strong proponent of this, but I tend to use dataclasses more and more with time. Still use a lot of dicts, lists, and sets, but mostly as collections, rarely to hold one single element data.

    It came naturally, not out of some design, but I guess having better and better typing support everywhere makes it more and more convenient.

  • I like the simplicity but there are some social problems with this. Let's say that I work on a team which has codebases with classes/dataclasses and I add a new codebase that doesn't use them, or one that doesn't _underscore just about everything - the first thing that will come up in the code review is questions about why I'm doing things differently, and I wouldn't have a good reason apart from the fact that I find it more aesthetically pleasing.

  • > A Python dictionary has a simple & well-known API.

    Actually it doesn't.

  • Except when you need Pandas dataframes or Apache Arrows