[Python-Dev] Re: Let's Fix Class Annotations -- And Maybe Annotations Generally

2021-04-19 Thread Larry Hastings
As long as I'm gravedigging old conversations...!  Remember this one, also from January of this year?  Here's a link to the thread in the c.l.p-d Mailman archive.  The first message in the thread is a good overview of the problem: https://mail.python.org/archives/list/python-dev@python.

[Python-Dev] Re: Should Python typing leverage PEP 263 as a pre-processor step?

2021-04-19 Thread Guido van Rossum
On Mon, Apr 19, 2021 at 8:16 PM Glenn Linderman wrote: > On 4/19/2021 12:44 PM, Guido van Rossum wrote: > > We had a similar thing at Dropbox, where `# coding: pyxl` would enable > > a preprocessor that allowed HTML embedded in the Python code. It > > translated this to function calls and string

[Python-Dev] Re: Should Python typing leverage PEP 263 as a pre-processor step?

2021-04-19 Thread Glenn Linderman
On 4/19/2021 12:44 PM, Guido van Rossum wrote: We had a similar thing at Dropbox, where `# coding: pyxl` would enable a preprocessor that allowed HTML embedded in the Python code. It translated this to function calls and string literals. There were however several drawbacks: - Installing the

[Python-Dev] Re: PEP 563 in light of PEP 649

2021-04-19 Thread Jelle Zijlstra
El lun, 19 abr 2021 a las 14:17, Larry Hastings () escribió: > On 4/19/21 1:37 PM, Ethan Furman wrote: > > On 4/19/21 10:51 AM, Larry Hastings wrote: > > Something analogous /could/ happen in the PEP 649 branch but currently > doesn't. When running Inada Noki's benchmark, there are a total of nin

[Python-Dev] Re: PEP 654: Exception Groups and except* [REPOST]

2021-04-19 Thread Nathaniel Smith
On Mon, Apr 5, 2021 at 9:48 AM Irit Katriel wrote: > On Mon, Apr 5, 2021 at 11:01 AM Nathaniel Smith wrote: >> - I'm uncomfortable with how in some contexts we treat EG's as placeholders >> for the contained exceptions, and other places we treat them like a single >> first-class exceptions. (Wi

[Python-Dev] Re: PEP 563 in light of PEP 649

2021-04-19 Thread Rob Cliffe via Python-Dev
On 19/04/2021 22:01, Antoine Pitrou wrote: Almost nobody uses -O. Optimizations that are enabled only in -O are useless. Data point: I use -O.¹  Not frequently, not usually, but I have a few large² programs that I add features to from time to time and will doubtless continue to do so.  I need

[Python-Dev] Re: PEP 563 in light of PEP 649

2021-04-19 Thread Larry Hastings
On 4/19/21 1:37 PM, Ethan Furman wrote: On 4/19/21 10:51 AM, Larry Hastings wrote: Something analogous /could/ happen in the PEP 649 branch but currently doesn't.  When running Inada Noki's benchmark, there are a total of nine possible annotations code objects.  Except, each function generate

[Python-Dev] Re: PEP 563 in light of PEP 649

2021-04-19 Thread Antoine Pitrou
On Mon, 19 Apr 2021 13:37:56 -0700 Ethan Furman wrote: > On 4/19/21 10:51 AM, Larry Hastings wrote: > > > Something analogous /could/ happen in the PEP 649 branch but currently > > doesn't.  When running Inada Noki's benchmark, > > there are a total of nine possible annotations code objects.  E

[Python-Dev] Re: PEP 563 in light of PEP 649

2021-04-19 Thread Ethan Furman
On 4/19/21 10:51 AM, Larry Hastings wrote: Something analogous /could/ happen in the PEP 649 branch but currently doesn't.  When running Inada Noki's benchmark, there are a total of nine possible annotations code objects.  Except, each function generated by the benchmark has a unique name, and

[Python-Dev] Re: Should Python typing leverage PEP 263 as a pre-processor step?

2021-04-19 Thread Guido van Rossum
We had a similar thing at Dropbox, where `# coding: pyxl` would enable a preprocessor that allowed HTML embedded in the Python code. It translated this to function calls and string literals. There were however several drawbacks: - Installing the codec is a bit tricky, and if you don't have it the

[Python-Dev] Should Python typing leverage PEP 263 as a pre-processor step?

2021-04-19 Thread Luciano Ramalho
How about leveraging the `# coding=` hook that exists since 2001 to enable the alternative syntax some are advocating for type hints? PEP 263—Defining Python Source Code Encodings https://www.python.org/dev/peps/pep-0263/ I've seen experiments in the wild using that to support syntax extensions t

[Python-Dev] Re: PEP 563 in light of PEP 649

2021-04-19 Thread Larry Hastings
Oops: where I said nine, I should have said, twenty-seven.  3-cubed.  Should have had my coffee /before/ posting.  Carry on! //arry/ On 4/19/21 10:51 AM, Larry Hastings wrote: I noticed something this morning: there's another way in which Inada Naoki's benchmark here is--possibly?--unre

[Python-Dev] Re: PEP 563 in light of PEP 649

2021-04-19 Thread Larry Hastings
I noticed something this morning: there's another way in which Inada Naoki's benchmark here is--possibly?--unrealistic. As mentioned, his benchmark generates a thousand functions, each of which takes exactly three parameters, and each of those parameters randomly chooses one of three annota

[Python-Dev] [Release manager team communication] 3.10 feature freeze is 2 weeks away

2021-04-19 Thread Pablo Galindo Salgado
Hi everyone, This is a friendly reminder from the release manager team that Python 3.10 feature freeze is two weeks away (Monday, 3 May 2021). Please, be aware of the following: * No new features or improvements should be merged after feature freeze. >From the devguide (https://devguide.python.o

[Python-Dev] [Release manager team communication] 3.10 feature freeze is 2 weeks away

2021-04-19 Thread Pablo Galindo Salgado
Hi everyone, This is a friendly reminder from the release manager team that Python 3.10 feature freeze is two weeks away (Monday, 3 May 2021). Please, be aware of the following: * No new features or improvements should be merged after feature freeze. >From the devguide (https://devguide.python.o

[Python-Dev] Re: In support of PEP 649

2021-04-19 Thread Samuel Colvin
> > As far as I know, both Pydantic and marshmallow start using annotation > for runtime type after PEP 563 is accepted. Am I right? Not quite, pydantic was released in June 2017 (see HN post: https://news.ycombinator.com/item?id=14477222) and always used annotations, PEP 563 was created in Septe

[Python-Dev] Re: In support of PEP 649

2021-04-19 Thread Samuel Colvin
There are a number of issues around recursive types, in general PEP 563 doesn't make a big difference either way in this case. I think you mean something like from pydantic import BaseModel from typing import Optional class Foo(BaseModel): x: int foo: Optional['Foo'] Foo.update_forward_