Sequence splitting

Terry Reedy tjreedy at udel.edu
Fri Jul 3 15:27:25 EDT 2009


Paul Rubin wrote:
> Brad <schickb at gmail.com> writes:
>> Maybe this would be difficult to get into the core, but how about this
>> idea: Rename the current filter function to something like "split" or
>> "partition" (which I agree may be a better name) and modify it to
>> return the desired true and false sequences. Then recreate the
>> existing "filter" function with a wrapper that throws away the false
>> sequence.
> 
> This isn't so attractive, since filter takes a sequence input but
> returns a list. 

In modern Python (py3), it returns an iterator.




More information about the Python-list mailing list