On Fri, Nov 26, 2021 at 1:47 PM Guido van Rossum <gu...@python.org> 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 pydantic just don't support such things and tell the user
not to do that.

I don’t know about Pydantic, but that’s exactly my use case: the type needs
to be an actual intstantiatable type.

So list and tuple is fine, and Sequence[t]  won’t work.  But it’s fine that
this use case is restricted.

In fact, other than the basic core types, you need to use specialized types
with this system anyway.

-CHB
-- 
Christopher Barker, PhD (Chris)

Python Language Consulting
  - Teaching
  - Scientific Software Development
  - Desktop GUI and Web Development
  - wxPython, numpy, scipy, Cython
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/CFRHK622JYFQ3MD6UBTAUS3UDY2UQ52F/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to