Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

There are several alternative API's. @dataclass is one, Pydantic offers another, there's also attrs, plus less general things like namedtuple.

Admittedly it's obnoxious when you've got habits for one and you're on a team that uses another--totally flies in the face of the zen re: "there should be only one obvious way to do things".

...but that was always a rather ambitious goal anyway. I'm ok navigating the forest of alternative API's if it means not being locked into something that I can only change by choosing an entirely different language. I'm happy that it's very easy to tell when somebody is mucking about with python internals vs when they're mucking about with some library or other.



@dataclass does a very specific subset of what overriding dunder methods does. It’s not duplicating an abstraction it’s layering them




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: