News for hackers. Stuff that matters.
Re:Htmy – Async, pure-Python rendering engine by franga2000 on Wednesday November 27, 2024 @02:59AM (#42253986)
Please don't! Pydantic demands 100% type correctness at runtime in a language that can't guarantee basically anything at "compile" (lint) time. Screw up one type annotation for one edge case and your entire system turns into one big ValidationError.

Dataclasses let you return "incorrect" data and that's a good thing. I'd rather get an unexpected None here and there (which can be handled) than have library code crash because the wrong type snuck into a field I don't even care about.

As for support, is any explicit support needed? You can Pydantic models into things expecting dataclasses and often the other way around too.

Re:Htmy – Async, pure-Python rendering engine by worthless-trash on Wednesday November 27, 2024 @03:11AM (#42254035)
Spoken like a true dynamic types programmer. Some programmers prefer having errors over these surprises.