[issue44939] proposal: add support for regex in Literal type hint
Leon Mintz
report at bugs.python.org
Tue Aug 17 16:11:12 EDT 2021
New submission from Leon Mintz <leon.mintz at gmail.com>:
Could typing.Literal (or analogous) accept a regex pattern to match against?
For example, if I want a duration string,
duration: str # allowed syntax: 3s, 3m, 3h etc.
vs
duration: LiteralPattern['[0-9]+[smh]']
----------
messages: 399787
nosy: leon.mintz
priority: normal
severity: normal
status: open
title: proposal: add support for regex in Literal type hint
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue44939>
_______________________________________
More information about the Python-bugs-list
mailing list