New submission from Andrew Svetlov <andrew.svet...@gmail.com>:

Typeshed declares asyncio.Future, asyncio.Task and asyncio.Queue as generic 
types, which is 100% correct.

The problem is that these classes don't support generic instantiation in 
runtime, e.g. Future[str] raises TypeError.

The feature should be implemented by adding __class_getitem__ methods which 
return self.

The patch is trivial but requires a few lines of C code for C Accelerated CTask 
and CFuture as well as updating Python code.

A volunteer is welcome!

----------
components: asyncio
keywords: easy, easy (C)
messages: 357848
nosy: asvetlov, yselivanov
priority: normal
severity: normal
status: open
title: Implement __class_getitem__ for Future, Task, Queue
versions: Python 3.9

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue38978>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to