[Python-ideas] Anonymous blocks (again):
Haoyi Li
haoyi.sg at gmail.com
Tue May 14 05:11:03 CEST 2013
I'm not arguing against "python is just so", I'm arguing against "function
chaining is inherently ugly".
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.
If people say "we shouldn't do this in python, because method chaining is
inherently ugly" I will disagree.
No need to chase me away from the python community and ask me to use a
different language =D
On Mon, May 13, 2013 at 10:54 PM, Stephen J. Turnbull <stephen at xemacs.org>wrote:
> Haoyi Li writes:
>
> > Method chaining *prevents* [intermingling unrelated code] from
> > happening in the first place, which is really nice. Even if I try
> > to avoid this, I haven't seen any code base where this hasn't
> > happened in various places, causing endless headaches.
>
> There's nothing intrinsicly wrong with your preference, but as far as
> I can see it's un-Pythonic. Specifically, as you mention method
> chaining is equivalent to carrying along an implicit "this" argument.
> But in Pythonic code, explicit is better than implicit. For that
> reason, methods with side effects generally have a useless return
> value (case in point: .sort()). In other words, making method
> chaining difficult is a deliberate design decision. You can disagree
> with that decision, but you *do* have a choice of languages, so Python
> doesn't *need* to accomodate your preference.
>
> Also (and this is more or less specious, but I don't have enough brain
> cells today to decide whether it's less or more), many people have
> difficulty with the functional tools approach you present in lieu of
> iteration statements. Python does provide those tools, but they're
> considered power tools to be used only when the expense in
> maintainability by mere mortals is considered carefully, and decided
> to be the lesser cost.
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20130513/9b982984/attachment.html>
More information about the Python-ideas
mailing list