Message376841
What it prints is irrelevant to static checking.
Currently the typeshed stub for the code already exports RegexFlag, so that the following passes mypy but fails at runtime:
```
from re import *
def foo(flag: RegexFlag):
return match("[a-z]+", "ABC", flag)
print(foo(IGNORECASE))
print(foo(VERBOSE))
```
I think it's good to add it to `__all__` so this code will not put the type checker to shame, and it would be good to document it.
One thing I discovered when developing this example: there doesn't seem to be a flag to represent 0 (zero), i.e. "no flags". And foo(0) is a type error (even though it works fine at runtime). |
|
Date |
User |
Action |
Args |
2020-09-13 18:12:58 | gvanrossum | set | recipients:
+ gvanrossum, ezio.melotti, mrabarnett, r.david.murray, docs@python, ethan.furman, serhiy.storchaka, levkivskyi, cheryl.sabella, PJB3005 |
2020-09-13 18:12:58 | gvanrossum | set | messageid: <1600020778.3.0.86954178631.issue31369@roundup.psfhosted.org> |
2020-09-13 18:12:58 | gvanrossum | link | issue31369 messages |
2020-09-13 18:12:58 | gvanrossum | create | |
|