[Python-Dev] Re: The current state of typing PEPs

2021-11-26 Thread Jim J. Jewett
Steven D'Aprano wrote: > On Sat, Nov 20, 2021 at 11:46:56PM -0800, Christopher Barker wrote: > Maybe PEP 563 could include a decorator in the typing module to > destringify all the annotations in a class or function? If it were in an annotations module, that would probably be sufficient. If it

[Python-Dev] Re: The current state of typing PEPs

2021-11-26 Thread Jim J. Jewett
Paul Moore wrote: > More hazy memories here, but I think the original proposal left open > the possibility of annotations not being types at all - for example, > being docstrings for the arguments, or option names for a "function > call to CLI" tool, etc. Absolutely. While it was clear that Guid

[Python-Dev] Re: The current state of typing PEPs

2021-11-26 Thread Guido van Rossum
So does your library work both with and without ‘from __future__ import annotations’? If it does, you shouldn’t have to worry. If it doesn’t, it would be useful if you could post some detailed examples of what goes wrong. On Fri, Nov 26, 2021 at 14:24 Christopher Barker wrote: > > > On Fri, Nov

[Python-Dev] Re: The current state of typing PEPs

2021-11-26 Thread Christopher Barker
On Fri, Nov 26, 2021 at 1:47 PM Guido van Rossum wrote > It's easy enough to do something at runtime with `def f(a: list[int]) -> int`. It's not so simple to handle `def f(a: Sequence[T]) -> T` or `def f(cb: (T) -> tuple[str, T], Sequence[T]) -> Mapping[str, T]`. Presumably frameworks like pydant

[Python-Dev] Re: The current state of typing PEPs

2021-11-26 Thread Christopher Barker
> There may > be scoping issues to be sorted out, > Yes, the scoping issues are the main problem. > > but I don't think they are > > insurmountable. Probably not — and LLukas Langa has some good ideas that the SC is considering. (Sorry I can’t get your name right in a phone) Maybe inspect.ge

[Python-Dev] Re: The current state of typing PEPs

2021-11-26 Thread Guido van Rossum
On Fri, Nov 26, 2021 at 11:58 AM Paul Moore wrote: > On Fri, 26 Nov 2021 at 17:13, Guido van Rossum wrote: > > >> Although the more I think about it, given that I believe dataclasses > >> use eval "under the hood", the less I understand *how* it manages to > >> do that without special-case knowl

[Python-Dev] Re: The current state of typing PEPs

2021-11-26 Thread Paul Moore
On Fri, 26 Nov 2021 at 17:13, Guido van Rossum wrote: >> Although the more I think about it, given that I believe dataclasses >> use eval "under the hood", the less I understand *how* it manages to >> do that without special-case knowledge of the dataclass decorator...) > > Static checkers specia

[Python-Dev] Summary of Python tracker Issues

2021-11-26 Thread Python tracker
ACTIVITY SUMMARY (2021-11-19 - 2021-11-26) Python tracker at https://bugs.python.org/ To view or respond to any of the issues listed below, click on the issue. Do NOT respond to this message. Issues counts and deltas: open7266 (-24) closed 50367 (+81) total 57633 (+57) Open issues wi

[Python-Dev] Re: The current state of typing PEPs

2021-11-26 Thread Guido van Rossum
On Fri, Nov 26, 2021 at 1:37 AM Paul Moore wrote: > On Thu, 25 Nov 2021 at 21:45, Christopher Barker > wrote: > > The issue is that, intended or not, typing is making it's way into > Python culture. As an instructor of beginning python users, I am unsure at > this point when to introduce type an

[Python-Dev] Re: The current state of typing PEPs

2021-11-26 Thread Antoine Pitrou
On Thu, 25 Nov 2021 23:51:58 + Oscar Benjamin wrote: > > > > Not a PEP proponent (or even a typing user), but I thought this had > > been made clear long ago. My understanding is that optional, > > incremental type hints are and have always been considered the primary > > use case for annotat

[Python-Dev] Re: The current state of typing PEPs

2021-11-26 Thread Sebastian Rittau
Am 26.11.21 um 01:48 schrieb Rob Cliffe via Python-Dev: ISTM that typing/annotations have been allowed to drift without a clear end in view, rather like a ship that is steered in one direction by one person, then in another by someone else, with nobody knowing what the destination port is. I

[Python-Dev] Re: The current state of typing PEPs

2021-11-26 Thread Paul Moore
On Thu, 25 Nov 2021 at 21:45, Christopher Barker wrote: > The issue is that, intended or not, typing is making it's way into Python > culture. As an instructor of beginning python users, I am unsure at this > point when to introduce type annotations. > > What is their role? Up to today, I have t

[Python-Dev] Re: The current state of typing PEPs

2021-11-26 Thread Paul Moore
On Fri, 26 Nov 2021 at 05:14, Guido van Rossum wrote: > > My memory is also hazy, but I'm quite sure that *in my mind* annotations were > intended as a compromise between conflicting proposals for *typing*. We > didn't have agreement on the syntax or semantics, but we did know we wanted > to do

[Python-Dev] Re: The current state of typing PEPs

2021-11-26 Thread Stephen J. Turnbull
Steven D'Aprano writes: > I don't think that's what PEP 563 says. Annotations are not > *restricted* to only be strings, it is merely that when the > function or class object is built, the annotations are left as > strings. You're right, I was imprecise. I meant as PEP 563 is implemented now