Switch language한국어
Back to the list

Opaque Types in Python | Hacker News

TL;DR AI

Key summary

2 min read
  1. A Hacker News discussion revisits Python opaque types and whether constructors should be public in APIs.

  2. The post compares dataclass-based designs with underscore/private-field conventions for hiding implementation details.

  3. It argues that Python can bypass normal initialization with low-level tricks like object.__new__, but those patterns are clunky and weakly supported by tooling.

  4. The broader debate is how to make APIs safer and more explicit without relying on conventions that are easy to ignore.

Read the original