
I agree with Jelle. While I have no objections to PEP 675, and while I fully understand that it would be very useful for many Python users, I have no uses for this PEP personally. Using `Literal[str]` to mean "exactly the str type", however, is something I have previously felt the need for (albeit infrequently), and seems like a much more intuitive meaning for the syntax. So while I bear this PEP no ill will, I would also prefer that some other spelling were used, instead of `Literal[str]`. Best, Alex
On 12 Jan 2022, at 19:04, Jelle Zijlstra <jelle.zijlstra@gmail.com> wrote:
It's been a while since this PEP (now PEP 675) was proposed, but I have a piece of feedback: I prefer that we use some other spelling than `Literal[str]`, because the more natural meaning of `Literal[str]` would be "exactly the str type". Currently Literal[] doesn't support types, but I don't want to close the door to adding support in the future, and a use case just came up in https://github.com/python/typing/discussions/1020.
An alternative spelling could be `LiteralOnly[str]`.
El mar, 23 nov 2021 a las 20:06, S Pradeep Kumar (<gohanpra@gmail.com>) escribió: Hello all,
We've drafted a PEP to support arbitrary literal string types [1]. Feedback appreciated!
Scala has a very similar concept. See this talk on using Scala's literal string types for "Preventing SQL injection at compile time" [2]
Bikeshedding: We're open to any name that seems easy to understand :)
-- Best, S Pradeep Kumar Graham Bleaney
[1]: https://docs.google.com/document/d/1fbAbA2MCoAcSO1c8gecmUJYZ-Q0utT3CmaXlQ3Ih...
[2]: https://slideslive.com/38907881/literal-types-what-they-are-good-for (slides 52 to 68)
[3]: Previous typing-sig thread: https://mail.python.org/archives/list/typing-sig@python.org/thread/JJWAA5AHZ... _______________________________________________ Typing-sig mailing list -- typing-sig@python.org To unsubscribe send an email to typing-sig-leave@python.org https://mail.python.org/mailman3/lists/typing-sig.python.org/ Member address: jelle.zijlstra@gmail.com
Typing-sig mailing list -- typing-sig@python.org To unsubscribe send an email to typing-sig-leave@python.org https://mail.python.org/mailman3/lists/typing-sig.python.org/ Member address: alex.waygood@gmail.com