Skip to content

Comment on Python classes aren’t always the best solution

Comments

Managing State with Simple Structures: Use Dictionaries or Lists

This is bad advice because you wind up hardcoding (or using vars for your key names, slightly better) your behavior on the state of the dict. Seriously, why not just make a class? You get better IDE and possibly better LLM support.

It's trivial to subclass dict and list anyway.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.