This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients neologix, pitrou, pklanke, vstinner, yselivanov
Date 2017-07-05.07:32:03
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
> "urgent data", "High-priority data"

How is an application supposed to handle these data? Read them before any other data?

The selectors API returns a list of (key, events) tuples. So an application has to iterate on this list twice? A first time to look for urgent data, and then iterate again to handle other events?


ready =
for key, events in ready:
   if events & selectors.EVENT_URGENT:
       process_urgent_event(key, events)
for key, events in ready:
   process_other_events(key, events)

I just want to make sure that I understand correctly how these events should be used.

Would it be worth it to provide an helper to group urgent event and other events? Maybe a new select_urgent() method which would return two lists?

A selector which creates the ready list already knows if an event is urgent or not, and so could directly group them in two separated lists.

"Urgent event" doens't mean that would only contain EVENT_URGENT, it can contain other events. So maybe the grouping function should be something like:

ready_urgent = []
ready = []
for ...:
   key = ...
   events = ...
   if not key:
   if events == EVENT_URGENT:
      ready_urgent.append((key, & events))
   elif events & EVENT_URGENT:
      ready_urgent.append((key, & events))
      ready.append((key, & events))
      ready.append((key, & events))

I don't know if it makes sense :-) Maybe it's better to let applications handle that themself ;-)
Date User Action Args
2017-07-05 07:32:03vstinnersetrecipients: + vstinner, pitrou, neologix, yselivanov, pklanke
2017-07-05 07:32:03vstinnersetmessageid: <>
2017-07-05 07:32:03vstinnerlinkissue30844 messages
2017-07-05 07:32:03vstinnercreate