<div class="gmail_quote">On 21 December 2011 00:24, Nathan Rice <span dir="ltr"><<a href="mailto:nathan.alexander.rice@gmail.com" target="_blank">nathan.alexander.rice@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">


<div>efoo_res = ((efoo2.capitalize() + " little indian").split("</div>
").apply(reversed) * 2).apply("_".join) # note that you could do<br>
reversed(...) instead, I just like to read left to right<br>
efoo_res.parent.parent.parent # same as ((efoo2.capitalize() + "<br>
little indian").split(" ") in case you need to debug something and<br>
want to look at intermediate values<br></blockquote><div><br></div><div>How is any of this better than the elementwise operators ("~")? People should be able to expect len(x) to <b>always</b> return a number or raise an error. I know it's not part of the spec, but a lot breaks without these guarantees. When "str(x)" isn't a string, <b>all the formatting code breaks*</b>. And when the other suggestion ("~str(x)" or "str~(x)" or something similar) has all the benifits and none of the drawbacks, why should I use this?</div>


<div><br></div><div>Upon this implementation I take back my comment on the whole typing thing. Your title just really confused me.</div><div> </div><div>* You can't just make functions non-elementwise unless called through ".apply" either:</div>


<div>def str(x): return x.__str__()</div><div><br></div><div>Also note that I'm ignoring that "~" has a predefined meaning, making "~func(x)" valid already. That's a minor syntactic point, not a point of the proposal, that i stuck with just 'cause of the PEP.</div>

<div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
The idea is to provide a syntax that lets you do very complex things<br>
on collections in a more readable manner, without having 5 or 6 lines<br>
of generator expressions.<font color="#888888"><br></font></blockquote></div>