Added partition to facilitate bugfix in irclib.Irc.removeCallback.

This commit is contained in:
Jeremy Fincher 2003-04-20 17:17:50 +00:00
parent 7e1eb72849
commit e1dfcbd390

View File

@ -339,4 +339,14 @@ def flatten(seq, strings=False):
except TypeError: except TypeError:
yield elt yield elt
def partition(p, L):
no = []
yes = []
for elt in L:
if p(elt):
yes.append(elt)
else:
no.append(elt)
return (yes, no)
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78: # vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78: