[issue31369] re.RegexFlag is not included in __all__, makes type inference less useful

2022-02-04 Thread Ethan Furman


Ethan Furman  added the comment:

Thanks, everyone!

--
components: +Library (Lib) -Regular Expressions
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
type:  -> behavior
versions: +Python 3.11 -Python 3.7, Python 3.8

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue31369] re.RegexFlag is not included in __all__, makes type inference less useful

2022-02-04 Thread Ethan Furman


Ethan Furman  added the comment:


New changeset fea7290a0ecee09bbce571d4d10f5881b7ea3485 by andrei kulakov in 
branch 'main':
bpo-31369: include ``RegexFlag`` in ``re.__all__`` (GH-30279)
https://github.com/python/cpython/commit/fea7290a0ecee09bbce571d4d10f5881b7ea3485


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue31369] re.RegexFlag is not included in __all__, makes type inference less useful

2021-12-27 Thread Andrei Kulakov


Change by Andrei Kulakov :


--
keywords: +patch
nosy: +andrei.avk
nosy_count: 10.0 -> 11.0
pull_requests: +28495
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/30279

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue31369] re.RegexFlag is not included in __all__, makes type inference less useful

2020-09-13 Thread Guido van Rossum


Guido van Rossum  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 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue31369] re.RegexFlag is not included in __all__, makes type inference less useful

2020-09-12 Thread Ethan Furman


Ethan Furman  added the comment:

Guido, do you have an opinion on adding `RegexFlag` to the `re` module's 
`__all__` and documenting it?

There is also some discussion on making these types of int-to-Enum conversions 
use a `module.name` repr instead of `class.name`:

used to be:

>>> re.I


is now:

>>> re.I
re.IGNORECASE

I of course have no idea if that matters to typing one way or the other.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue31369] re.RegexFlag is not included in __all__, makes type inference less useful

2019-04-06 Thread Ivan Levkivskyi


Ivan Levkivskyi  added the comment:

I am totally fine with making RegexFlag public (this may be indeed useful for 
static typing purposes).

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue31369] re.RegexFlag is not included in __all__, makes type inference less useful

2019-03-25 Thread Ethan Furman


Ethan Furman  added the comment:

I see no reason no prefix `RegexFlag` with an `_`.

As far as adding it to `__all__` -- I didn't originally because I was trying to 
mirror the original implementation, but I am not against it.  I would defer 
that decision to those that work on typing.

--
assignee: docs@python -> 
components:  -Documentation
nosy: +gvanrossum, levkivskyi
title: re.RegexFlag is not included in __all__ -> re.RegexFlag is not included 
in __all__, makes type inference less useful

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com