[Python-ideas] Add an introspection API to Executor
Dan O'Reilly
oreilldf at gmail.com
Tue Aug 26 05:31:21 CEST 2014
In that case, what's the best way to disallow use of APIs that require an
introspectable queue implementation? Using isinstance(self._work_queue,
IntrospectableQueue) would work, but seems to be nearly as limiting as
using an introspectable keyword. Perhaps IntrospectableQueue could support
__iter__ as a way of iterating over a snapshot of enqueued items - The
Executor could try iterating over the queue when it needs to inspect its
contents, raising an appropriate exception (something like "Provided queue
class must be introspectable") if that fails. If people prefer __iter__
isn't used for that purpose, we could just do the same thing with whatever
public method ends up being used to get the snapshot instead.
On Mon, Aug 25, 2014 at 11:02 PM, Ethan Furman <ethan at stoneleaf.us> wrote:
> On 08/25/2014 07:51 PM, Dan O'Reilly wrote:
>
>>
>> The IntrospectableQueue idea seems reasonable to me. I think I would
>> prefer passing an introspectable (or similar)
>> keyword to the Executor rather than a queue class, though.
>>
>
> Passing the class is the better choice -- it means that future needs can
> be more easily met by designing the queue variant needed and passing it in
> -- having a keyword to select only one option is unnecessarily limiting.
>
> --
> ~Ethan~
>
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20140825/93966280/attachment-0001.html>
More information about the Python-ideas
mailing list