[Python-Dev] Re: PEP 647 (type guards) -- final call for comments

2021-02-13 Thread Greg Ewing
On 14/02/21 8:48 am, Eric Traut wrote: def is_str_list(val: Constrains[List[object]:List[str]) -> bool: ... Maybe something like this? def is_str_list(val: List[str] if True else List[object]) -> bool: ... -- Greg ___ Python-Dev mailing

[Python-Dev] Re: PEP 647 (type guards) -- final call for comments

2021-02-13 Thread Paul Sokolovsky
Hello, On Sat, 13 Feb 2021 19:48:10 - "Eric Traut" wrote: [] > Paul said: > >...to work around deficiencies in the current generation of Python > >typecheckers > > It sounds like you're implying that this functionality will be no > longer needed at some point in the future when type

[Python-Dev] Re: PR Review request - bpo-41928: Add support for Unicode Path Extra Field in ZipFile

2021-02-13 Thread Andrea Giudiceandrea via Python-Dev
Terry Reedy wrote: > I nosied and requested a review from the active zipfile 'expert' (Serhiy). Thank you Terry. Regards. Andrea ___ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-le...@python.org

[Python-Dev] Re: PEP 647 (type guards) -- final call for comments

2021-02-13 Thread Eric Traut
I think it's a reasonable criticism that it's not obvious that a function annotated with a return type of `TypeGuard[x]` should return a bool. That said, the idea of a user-defined type guard comes from TypeScript, where the syntax is described

[Python-Dev] Re: Python standardization

2021-02-13 Thread Chris Angelico
On Sun, Feb 14, 2021 at 7:38 AM Wes Turner wrote: > > https://awesome-safety-critical.readthedocs.io/en/latest/ > https://awesome-safety-critical.readthedocs.io/en/latest/#software-safety-standards > > What is and is not constant time in Python could be added to structured data > elements in

[Python-Dev] Re: Python standardization

2021-02-13 Thread Wes Turner
https://awesome-safety-critical.readthedocs.io/en/latest/ https://awesome-safety-critical.readthedocs.io/en/latest/#software-safety-standards What is and is not constant time in Python could be added to structured data elements in (implementations') docstrings. * "The Python Language

[Python-Dev] Re: Python standardization

2021-02-13 Thread Stephen J. Turnbull
Paul Sokolovsky writes: > Hello, > > On Sat, 13 Feb 2021 23:10:59 +0900 > "Stephen J. Turnbull" wrote: > > > Chris Angelico writes: > > > > > Can you explain what would be improved by having a formalized > > > standard? > > > > The Language Reference together with the Library

[Python-Dev] Re: Python standardization

2021-02-13 Thread Stefano Borini
Not sure about python, but throughout my career I had to work with MISRA C standardisation for critical systems. There is more and more that is handled by python that also needs to go through validation. I wonder if there's value in that? On Fri, 12 Feb 2021 at 18:40, Dan Stromberg wrote: > > >

[Python-Dev] Re: PEP 647 (type guards) -- final call for comments

2021-02-13 Thread Paul Moore
On Sat, 13 Feb 2021 at 17:33, Guido van Rossum wrote: > On Sat, Feb 13, 2021 at 2:38 AM Paul Moore wrote: >> >> I have to agree here. I'm not a frequent user of type hints yet, but I >> am starting to have to maintain code that has type hints, and from a >> maintenance perspective, I have to say

[Python-Dev] Re: Python standardization

2021-02-13 Thread Mats Wichmann
On 2/12/21 5:19 PM, Guido van Rossum wrote: From talking to people who at various times have participated in a language standardization process, I've learned that it's not a panacea, it's an enormous amount of work, it doesn't guarantee a good outcome, and plenty of languages do just fine

[Python-Dev] Re: PEP 647 (type guards) -- final call for comments

2021-02-13 Thread Guido van Rossum
> On Sat, 13 Feb 2021 at 07:11, Steven D'Aprano wrote: > > Without reading the PEP, how is anyone supposed to know that this > > returns a bool? > By looking at the name, or at the return statements in the body. These are expected to be really short. Tooling can certainly easily be taught what

[Python-Dev] Re: Python standardization

2021-02-13 Thread Luciano Ramalho
On Fri, Feb 12, 2021 at 3:36 PM Dan Stromberg wrote: > I think standardizing Python might be really good for controlling its growth > and avoiding featuritis. The dynamics of standard committees lead to even more acute cases of featuritis: "I support your pet feature if you support mine."

[Python-Dev] Re: PEP 597: Add optional EncodingWarning

2021-02-13 Thread Inada Naoki
To demonstrate how this warning is useful, I used my reference implementation. When I try `pip install`, I found these issues soon. https://bugs.python.org/issue43214 (Open pth file with locale-encoding) https://github.com/pypa/pip/pull/9608 (Not a real bug, but open JSON file with

[Python-Dev] Re: Python standardization

2021-02-13 Thread Paul Sokolovsky
Hello, On Sat, 13 Feb 2021 23:10:59 +0900 "Stephen J. Turnbull" wrote: > Chris Angelico writes: > > > Can you explain what would be improved by having a formalized > > standard? > > The Language Reference together with the Library Reference *already* > constitute a formalized standard.

[Python-Dev] Re: Python standardization

2021-02-13 Thread Stephen J. Turnbull
Chris Angelico writes: > Can you explain what would be improved by having a formalized > standard? The Language Reference together with the Library Reference *already* constitute a formalized standard. They are at least as precise as most W3C or IETF standards. What you and Dan seem to be

[Python-Dev] Re: Python standardization

2021-02-13 Thread Antoine Pitrou
On Fri, 12 Feb 2021 21:54:44 +0300 Ivan Pozdeev via Python-Dev wrote: > How a standard by ANSI, ECMA and/or ISO is any better than a standard by the > PSF? The PSF has nothing to do with it. The Python language is controlled by the core development team. I wouldn't be surprised if some

[Python-Dev] Re: PEP 647 (type guards) -- final call for comments

2021-02-13 Thread Paul Moore
On Sat, 13 Feb 2021 at 07:11, Steven D'Aprano wrote: > > On Fri, Feb 12, 2021 at 10:27:01AM +, Mark Shannon wrote: > > > It impairs readability, because it muddles the return type. > > The function in the example returns a bool. > > The annotation is also misleading as the annotation is on

[Python-Dev] Re: PEP 647 (type guards) -- final call for comments

2021-02-13 Thread Paul Sokolovsky
Hello, On Sat, 13 Feb 2021 18:08:30 +1100 Steven D'Aprano wrote: > On Fri, Feb 12, 2021 at 10:27:01AM +, Mark Shannon wrote: > > > It impairs readability, because it muddles the return type. > > The function in the example returns a bool. > > The annotation is also misleading as the