[Python-Dev] PEP 484 (Type Hints) -- the next draft is here (original) (raw)
Guido van Rossum guido at python.org
Sat Apr 18 18:38:15 CEST 2015
- Previous message (by thread): [Python-Dev] PEP 484 (Type Hints) -- the next draft is here
- Next message (by thread): [Python-Dev] PEP 484 (Type Hints) -- the next draft is here
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
That's a good question. We could make it so that you can subclass Generator and instantiate the instances; or we could even make it do some structural type checking. (Please file a pull request or issue for this at github.com/ambv/typehinting .) But perhaps we should also change asyncio? What check are you talking about?
On Fri, Apr 17, 2015 at 10:35 PM, Stefan Behnel <stefan_ml at behnel.de> wrote:
Guido van Rossum schrieb am 17.04.2015 um 23:58: > The
typing
module defines theGenerator
type for return values > of generator functions. It is a subtype ofIterable
and it has > additional type variables for the type accepted by thesend()
> method and the return type of the generator: > > * Generator, used asGenerator[yieldtype, sendtype, returntype]
Is this meant to accept only Python generators, or any kind of object that implements the coroutine protocol? I'm asking because asyncio currently suffers from an annoying type check here, so I'd like to avoid that this problem keeps popping up again in other places. Stefan
Python-Dev mailing list Python-Dev at python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/guido%40python.org
-- --Guido van Rossum (python.org/~guido) -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20150418/f465836e/attachment.html>
- Previous message (by thread): [Python-Dev] PEP 484 (Type Hints) -- the next draft is here
- Next message (by thread): [Python-Dev] PEP 484 (Type Hints) -- the next draft is here
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]