filter is bad when you use lambda with it<div>there are (good) cases for filter<br><br><div class="gmail_quote">On 14 August 2012 22:39, Jean-Michel Pichavant <span dir="ltr"><<a href="mailto:jeanmichel@sequans.com" target="_blank">jeanmichel@sequans.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Ramchandra Apte wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">
(Much) more Pythonic solution:<br>
>>> filter(None,"|".split("|"))<br>
<br></div><div class="im">
On 14 August 2012 15:14, Andreas Tawn <<a href="mailto:andreas.tawn@ubisoft.com" target="_blank">andreas.tawn@ubisoft.com</a> <mailto:<a href="mailto:andreas.tawn@ubisoft.com" target="_blank">andreas.tawn@ubisoft.<u></u>com</a>>> wrote:<br>

<br>
    > I have a question about the split function? surpose a = "|",and<br>
    when I use a.split("|") , I got the list<br>
    > ['"",""] ,but I want to get the empty list,what should I do ?<br>
<br>
    Something like...<br>
<br>
    >>> [x for x in "|".split("|") if x]<br>
    []<br>
<br>
    Cheers,<br>
<br>
    Drea<br>
    --<br>
    <a href="http://mail.python.org/mailman/listinfo/python-list" target="_blank">http://mail.python.org/<u></u>mailman/listinfo/python-list</a><br>
<br>
<br>
</div></blockquote>
A pythonic answer would be bottom-posted :p<span class="HOEnZb"><font color="#888888"><br>
<br>
JM<br>
</font></span><br>
<br>
PS : pylint raises a low warning about *filter* being non pythonic, <a href="http://pylint-messages.wikidot.com/messages:w0141" target="_blank">http://pylint-messages.<u></u>wikidot.com/messages:w0141</a><br>
"les goûts et les couleurs ne se discutent pas"<br>
</blockquote></div><br></div>