New submission from STINNER Victor: multiprocess, telnetlib (and subprocess in a near future, see #18923) use the following code to select the best selector:
# poll/select have the advantage of not requiring any extra file descriptor, # contrarily to epoll/kqueue (also, they require a single syscall). if hasattr(selectors, 'PollSelector'): _TelnetSelector = selectors.PollSelector else: _TelnetSelector = selectors.SelectSelector I don't like the principle of "a default selector", selectors.DefaultSelector should be removed in my opinion. I would prefer a function returning the best selector using constraints. Example: def get_selector(use_fd=True) -> BaseSelector: ... By default, it would return the same than the current DefaultSelector. But if you set use_fd=False, the choice would be restricted to select() or poll(). I don't want to duplicate code like telnetlib uses in each module, it's harder to maintain. The selectors module may get new selectors in the future, see for example #18931. Except use_fd, I don't have other ideas of constraints. I read somewhere that differenet selectors may have different limits on the number of file descriptors. I don't know if it's useful to use such constraint? ---------- messages: 201855 nosy: gvanrossum, haypo, neologix priority: normal severity: normal status: open title: selectors: provide a helper to choose a selector using constraints versions: Python 3.4 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue19465> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com