A literal string type for Python
A literal string type for Python
Posted Apr 14, 2022 1:20 UTC (Thu) by milesrout (guest, #126894)Parent article: A literal string type for Python
This seems like a very good design. It speaks volumes that (at least from what I can tell from reading this article) the type system did not need to be modified to make this work. Many type systems in common use today could not represent this sort of subtyping relationship, as doing LiteralString.__add__(LiteralString) would give back a str. And it all disappears into the background without getting in your way if you just want to write normal Python without type annotations.
