[Python-ideas] Add pop_callback to deque signature
Serhiy Storchaka
storchaka at gmail.com
Wed Oct 4 01:47:46 EDT 2017
04.10.17 07:58, Nick Coghlan пише:
> For deque specifically, I like Steven D'Aprano's suggestion of a
> "__dropped__" or "__discard__" subclassing API that makes it
> straightforward to change the way that queue overruns are handled
> (especially if raising an exception from the new subclass method can
> prevent the collection modification entirely - that way you could
> readily change the deque semantics in a subclass such that if the
> queue fills up, submitters start getting errors instead of silently
> discarding older messages, allowing backpressure to be more easily
> propagated through a system of queues).
Wouldn't this harm performance? Looking up the attribute of the type is
more costly than pushing/popping the item in the deque.
More information about the Python-ideas
mailing list