|
|
Log in / Subscribe / Register

"Structural pattern matching" for Python, part 2

"Structural pattern matching" for Python, part 2

Posted Sep 13, 2020 11:11 UTC (Sun) by plugwash (subscriber, #29694)
In reply to: "Structural pattern matching" for Python, part 2 by ehiggs
Parent article: "Structural pattern matching" for Python, part 2

> You are correct that a PyObject is a tagged union.

I would argue it's more akin to a base class than to a tagged union with the "ob_type" field serving a role similiar to a vptr.

To me at least "tagged union" implies that the list of subtypes is determined in advance and sufficient memory is allocated to store any of the subtypes.


to post comments


Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds