Partition Recursive

Ian Kelly ian.g.kelly at gmail.com
Fri Dec 24 00:33:15 EST 2010


On 12/23/2010 10:03 PM, kj wrote:
>>>> import re # sorry
>>>> sp = re.compile('(//?|[;?:@=&#.])')
>>>> filter(len, sp.split(url))

Perhaps I'm being overly pedantic, but I would likely have written that 
as "filter(None, sp.split(url))" for the same reason that "if string:" 
is generally preferred to "if len(string):".

Cheers,
Ian




More information about the Python-list mailing list