[Python-bugs-list] [ python-Feature Requests-798046 ] select module
doesn't allow any iterable.
SourceForge.net
noreply at sourceforge.net
Wed Sep 10 13:24:38 EDT 2003
Feature Requests item #798046, was opened at 2003-08-31 00:31
Message generated for change (Settings changed) made by bcannon
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=355470&aid=798046&group_id=5470
>Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Jeremy Fincher (jemfinch)
Assigned to: Nobody/Anonymous (nobody)
Summary: select module doesn't allow any iterable.
Initial Comment:
The select module only allows lists, not any
iterable. While this may slightly increase efficiency
for the select.select() function itself, for many
applications passing select.select a sets.Set would
probably be much more efficient (i.e., when things
are being added/removed from the readable or
writable lists quite often, the O(n) removal of lists
would certainly be worse than the O(1) removal of
sets.)
----------------------------------------------------------------------
Comment By: Brett Cannon (bcannon)
Date: 2003-09-06 15:22
Message:
Logged In: YES
user_id=357491
There seems to be two things that are preventing the use of an
object that supports the iterator protocol instead of a list. One is
the explicit check that the arguments are lists; PyList_Check is run
on the passed-in lists for a basic sanity check. Then there is a call
to a function called list2set that takes in a Python list and then
sets the passed-in fd_set properly. In that function there is
nothing that screams "we should only use lists" beyond it allows
assuming a list and thus doesn't have any hoops to jump through.
But the iterator protocol was set up to minimize hoop jumping.
There seems to be little stopping a move over to using the iterator
protocol beyond a minimial amount of recoding to rip out the list
check to replace it with PyIter_Check and instead of using a 'for'
loop through a list you just use a 'while' calling PyIter_Next .
But since this seems to have gone so long without being changed I
would feel better about having someone tell me it is okay to
change. I will email python-dev and ask.
----------------------------------------------------------------------
Comment By: Armin Rigo (arigo)
Date: 2003-09-02 11:23
Message:
Logged In: YES
user_id=4771
Using select.poll() instead of select.select() might be a
good alternative, at least on platforms that support it, if
the sets are getting large enough for you to want to avoid
having to build lists explicitely as in :
select.select(list(a), list(b), list(c))
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=355470&aid=798046&group_id=5470
More information about the Python-bugs-list
mailing list