Author scoder
Recipients asvetlov, gvanrossum, scoder, vstinner, yselivanov
Date 2015-05-01.12:19:21
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1430482762.81.0.0161440712075.issue24017@psf.upfronthosting.co.za>
In-reply-to
Content
> 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.

You seem to be assuming that the outer loop is the asyncio I/O loop. That might not be the case. It might be a thread-pool executor, it might be an in-memory task switcher, or it might just be something passing on items from a list. At least "__anext__" is worth being fast, IMHO.

Also note that one advantage of slots is that the user can cache their value to keep calling the same C function multiple times. That is not the case for a Python method, which can easily be replaced. Some iterators do that with their __next__ method, and it's perfectly valid. Having to look up the Python method on each iteration and calling through it sounds like unnecessary overhead.
History
Date User Action Args
2015-05-01 12:19:22scodersetrecipients: + scoder, gvanrossum, vstinner, asvetlov, yselivanov
2015-05-01 12:19:22scodersetmessageid: <1430482762.81.0.0161440712075.issue24017@psf.upfronthosting.co.za>
2015-05-01 12:19:22scoderlinkissue24017 messages
2015-05-01 12:19:22scodercreate