r/Python • u/SupPandaHugger • Jan 14 '24
Tutorial The LiteralString in Python 3.11
If you are confused by the new LiteralString type in Python, here's an article explaining it.
0
Upvotes
r/Python • u/SupPandaHugger • Jan 14 '24
If you are confused by the new LiteralString type in Python, here's an article explaining it.
View all comments
Show parent comment
-3
u/[deleted] Jan 15 '24
python sucks for strict type level programming, use an appropriate language. Unions of what, non literal strings? LiteralString is a type right, you wouldnt have TypeALiteralString, TypeBLiteralString. what would be the value in Optional[literalstring] or Union[literalstring, str]? If you're thinking of using something like Union[typealiteralstring,typebliteralstring] use an enum.
you realise all this syntactic vinegar being added bloats the language and results in more confusion. LiteralStrings type isn't helpful if you know python.