Guido van Rossum <[email protected]> added the comment:
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).
----------
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue31369>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com