function to split strings and lists on predicate

Dave Angel davea at davea.name
Mon Jan 6 08:35:34 EST 2014


On Mon, 06 Jan 2014 06:48:11 +0000, Mark Lawrence 
<breamoreboy at yahoo.co.uk> wrote:
> I came across this over the weekend 
> 
http://paddy3118.blogspot.co.uk/2013/10/unifying-pythons-string-and-lis
t.html. 
>   I couldn't come up with a solution to the fsplit function that 
seemed 
> in any way cleaner.  What can our nest of avid Pythonistas come up 
with?

Looks like that link is already broken.  Try the first half of page:

http://paddy3118.blogspot.co.uk/2013_10_01_archive.html

I can't see any way to simplify the generator Paddy produced,  but 
the thing that bothered me is that it won't work on iterables, such 
as itself. For thar reason I think I'd stick with the separate 
functions,  or write an adaptor to convert a iterable of lists to one 
of strings.

-- 
DaveA




More information about the Python-list mailing list