Top all-time · #7875
The Three of Wands
Personal blog · threeofwands.comprogramming
The Three of Wands is a personal blog at threeofwands.com about programming. Since 2021, 10 different Hacker News readers have linked it 15 times, most often “I use Attrs instead of Pydantic”. The last post was in 2023, but the archive is still widely read.
Too few sampled comments (4) to say how often HN recommends it.?
Why HN links it
HN readers link this blog for its Python library writing, especially its argument for using attrs instead of Pydantic and its piece on approximating sum types in Python with Pydantic.
Summarised by Claude from a sample of 4 HN comments that link here. Each comment is marked recommending, critical or neutral (citing without judging); how this works.
My free software stuff.
Most-linked posts?
- I use Attrs instead of Pydantic4 people · 4 mentions · first linked 2021-08-25
- Algebraic Data Types in (Typed) Python4 people · 4 mentions · first linked 2023-04-06
- Wall vs. CPU time, or the cost of asyncio Tasks2 people · 2 mentions · first linked 2022-09-14
- The Categories of Bugs in Python Apps2 people · 2 mentions · first linked 2023-11-21
What Hacker News says?
To help answer your question, here's a detailed comparison from the attrs project: https://www.attrs.org/en/stable/why.html There's some obvious potential for bias there, but I thought most of the arguments were well reasoned. Edit: found another that I thought was helpful: https://threeofwands.com/why-i-use-attrs-instead-of-pydantic...
Comment linking /why-i-use-attrs-instead-of-pydantic/
on “I'm switching to Python and actually liking it”Submitted I use Attrs instead of Pydantic as a story · 132 points
HN discussionI think it would be useful to differentiate more clearly between what is offered by Python's type system, and what is offered by Pydantic. That is, you can approximate Rusts's enum (sum type) with pure Python using whatever combination of Literal, Enum, Union and dataclasses. For example (more here[1]): @dataclass class Foo: ... @dataclass class Bar: ... Frobulated = Foo | Bar Pydantic adds de/ser, but if you're not…
Comment linking /algebraic-data-types-in-python/
on “Approximating sum types in Python with Pydantic”Submitted Python is two languages now, and that's great as a story · 5 points
HN discussionI think this was on HN at some point, but this article makes the case for why/when you’d want to use attrs rather than pydantic. https://threeofwands.com/why-i-use-attrs-instead-of-pydantic...
Comment linking /why-i-use-attrs-instead-of-pydantic/
on “Attrs – the Python library everyone needs (2016)”Submitted Wall vs. CPU time, or the cost of asyncio Tasks as a story · 3 points
HN discussionC macros are just a text preprocessor. You could run the C preprocessor on a text file and have the result be Python code. Comments might be a little tricky, but it's doable. Or you can run a text file through a general-purpose one like m4. For sum types we have enums, and for product types we have tuples (or namedtuples or dataclasses). Sugar could be done with decorators or metaclasses. For Lisp macros, there's ma…
Comment linking /algebraic-data-types-in-python/
on “Ask HN: What are the nice feature you need in a programming language?”Submitted Algebraic Data Types in (Typed) Python as a story · 2 points
HN discussionSubmitted On structured and unstructured data, or the case for cattrs as a story · 2 points
HN discussionSubmitted Attrs iv: Zero-overhead Frozen attrs Classes as a story · 1 points
HN discussionSubmitted The Categories of Bugs in Python Apps as a story · 1 points
HN discussionSubmitted The Categories of Bugs in Python Apps as a story · 1 points
HN discussionSubmitted Why I use attrs instead of pydantic (2021) as a story · 1 points
HN discussionSubmitted Algebraic Data Types in (Typed) Python as a story · 1 points
HN discussionSubmitted Wall vs. CPU time, or the cost of asyncio Tasks as a story · 1 points
HN discussion