<div dir="ltr">I'm not arguing against "python is just so", I'm arguing against "function chaining is inherently ugly". <div><br></div><div style>If people say "we shouldn't do this in python, just because" "we shouldn't do this in python because it goes against the convention", I'm fine with that. </div>

<div style><br></div><div style>If people say "we shouldn't do this in python, because method chaining is inherently ugly" I will disagree. </div><div style><br></div><div style>No need to chase me away from the python community and ask me to use a different language =D</div>

</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, May 13, 2013 at 10:54 PM, Stephen J. Turnbull <span dir="ltr"><<a href="mailto:stephen@xemacs.org" target="_blank">stephen@xemacs.org</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Haoyi Li writes:<br>
<br>
 > Method chaining *prevents* [intermingling unrelated code] from<br>
<div class="im"> > happening in the first place, which is really nice. Even if I try<br>
 > to avoid this, I haven't seen any code base where this hasn't<br>
 > happened in various places, causing endless headaches.<br>
<br>
</div>There's nothing intrinsicly wrong with your preference, but as far as<br>
I can see it's un-Pythonic.  Specifically, as you mention method<br>
chaining is equivalent to carrying along an implicit "this" argument.<br>
But in Pythonic code, explicit is better than implicit.  For that<br>
reason, methods with side effects generally have a useless return<br>
value (case in point: .sort()).  In other words, making method<br>
chaining difficult is a deliberate design decision.  You can disagree<br>
with that decision, but you *do* have a choice of languages, so Python<br>
doesn't *need* to accomodate your preference.<br>
<br>
Also (and this is more or less specious, but I don't have enough brain<br>
cells today to decide whether it's less or more), many people have<br>
difficulty with the functional tools approach you present in lieu of<br>
iteration statements.  Python does provide those tools, but they're<br>
considered power tools to be used only when the expense in<br>
maintainability by mere mortals is considered carefully, and decided<br>
to be the lesser cost.<br>
<br>
<br>
</blockquote></div><br></div>