Yury Selivanov added the comment:

> Could we have type slots for the new special methods? Otherwise, implementing 
> the protocol in C would be fairly inefficient, especially for async iteration.

I don't think it's necessary to have slots for __aiter__, __anext__, __aenter__ 
and __aexit__.  Async iteration will never be as fast as regular iteration, and 
there is plenty overhead in it.  And we don't need slots for async context 
managers as we don't have slots for regular ones.

What might be a good idea is to add a slot for __await__ method -- tp_await.  
This will allow to implement Futures in C efficiently.  I'd rename 
'tp_reserved' for this purpose.

Victor, your thoughts?

----------

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

Reply via email to