[Python-ideas] Adding Type[C] support to PEP 484 and typing.py
kramm at google.com
Thu May 12 16:28:00 EDT 2016
On Thursday, May 12, 2016 at 11:50:32 AM UTC-7, Guido van Rossum wrote:
> There's one new feature I'd like to add to PEP 484 and the typing.py
> module that will go out with Python 3.5.2.
> There's a long discssion in https://github.com/python/typing/issues/107,
> but I think I can explain the proposal very quickly.
> There's currently no good way to talk about class objects. If you have a
> function argument that's a class (as opposed to an instance) the only
> annotation you can give it is `type`. But I've encountered this pattern
> quite frequently, and what people invariably want to say is "it's a
> subclass of this here class C."
I like it. I have wanted "Type[C]" many times, in pytype's output.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-ideas