This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author gvanrossum
Recipients PJB3005, cheryl.sabella, docs@python, ethan.furman, ezio.melotti, gvanrossum, levkivskyi, mrabarnett, r.david.murray, serhiy.storchaka
Date 2020-09-13.18:12:58
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1600020778.3.0.86954178631.issue31369@roundup.psfhosted.org>
In-reply-to
Content
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).
History
Date User Action Args
2020-09-13 18:12:58gvanrossumsetrecipients: + gvanrossum, ezio.melotti, mrabarnett, r.david.murray, docs@python, ethan.furman, serhiy.storchaka, levkivskyi, cheryl.sabella, PJB3005
2020-09-13 18:12:58gvanrossumsetmessageid: <1600020778.3.0.86954178631.issue31369@roundup.psfhosted.org>
2020-09-13 18:12:58gvanrossumlinkissue31369 messages
2020-09-13 18:12:58gvanrossumcreate