Mmastodon TechnologySoftware first seen 7 d ago, last 7 d ago, peak #11
Debate Over Implementing Equality Correctly in Python
Original: I don't get why people try to implement equality without knowing which values should be compared (also I think Pydantic
A programmer is questioning why developers implement equality methods without first deciding which values should actually be compared. They also suggest that Pydantic, the popular Python data validation library, makes this harder. The remark touches a familiar pain point in Python: defining __eq__ semantics for data classes and models is subtle, and frameworks often choose defaults that don't match users' expectations.
Why now: Equality semantics in Python and Pydantic models are a recurring source of confusion among developers
Evidence
- I don't get why people try to implement equality without knowing which values should be compared (also I think Pydantic make things harder?) 🤷♀️ # programming # python · onelsonsenna · 1
API: https://socialmediatrends-api.osmike.com/v1/trends/4909074