≈ the.bay.news

@sumtype: nested variants + implicit sealing for sum types

Discussions on Python.org
@sumtype: nested variants + implicit sealing for sum types
This is a design sketch, not a PEP. Prior discussions worth reading: Sum Types in the stdlib (Jul 2025), and the draft @sealed PEP. Why Sometimes we need sum types. Two approaches both have gaps: Plain inheritance: type checkers can’t verify exhaustiveness or flag unreachable branches, because anyone can define a new subclass later. @sealed: it gives the checker a closed hierarchy, but the variants stay as flat top-level classes. No namespacing. Before # assume from typing import sealed from...

0 comments

Sign in to join the discussion — your thebay.events account works here.

No comments yet.