Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.004 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'lawrence': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'seemed': 0.09; 'strings.': 0.09; 'jan': 0.12; 'itself.': 0.14; 'broken.': 0.16; 'iterable': 0.16; 'nest': 0.16; 'pythonistas': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'with?': 0.16; 'wrote:': 0.18; 'separate': 0.22; 'header:User- Agent:1': 0.23; 'stick': 0.24; 'mon,': 0.24; 'looks': 0.24; 'header:X-Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'function': 0.29; 'lists': 0.32; "i'd": 0.34; "can't": 0.35; 'convert': 0.35; 'subject:lists': 0.35; 'but': 0.35; 'half': 0.37; 'weekend': 0.38; 'to:addr:python-list': 0.38; "couldn't": 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'first': 0.61; 'such': 0.63; 'our': 0.64; 'url:blogspot': 0.65; 'url:co': 0.67; 'bothered': 0.68; 'url:2013': 0.84 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Dave Angel Subject: Re: function to split strings and lists on predicate Date: Mon, 06 Jan 2014 08:35:34 -0500 References: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Gmane-NNTP-Posting-Host: dpc6744199211.direcpc.com In-Reply-To: User-Agent: Groundhog Newsreader for Android X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 24 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1389015242 news.xs4all.nl 2954 [2001:888:2000:d::a6]:49165 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:63279 On Mon, 06 Jan 2014 06:48:11 +0000, Mark Lawrence 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