Method Chaining

Rustom Mody rustompmody at gmail.com
Fri Jun 17 12:48:05 EDT 2016


On Friday, June 17, 2016 at 2:58:19 PM UTC+5:30, Steven D'Aprano wrote:
> On Fri, 17 Jun 2016 06:13 pm, Ned Batchelder wrote:
> 
> > To me, it's a toss-up.  The chained version is nice in that it removes the
> > repetition of "g".  But the unchained version is more explicit, and avoids
> > the awkward parenthesis.
> > 
> > I think I would lean toward the unchained version.  Clearly tastes can
> > differ.
> 
> Indeed. For what it's worth, I'm ever-so-slightly leaning towards Lawrence's
> taste here.

More than 'slightly' out here!
One thing about python OOP that irritates me is the 'self.' clutter.
With a Pascal/VB style with-statement its naturally taken care of

Yeah I know there is this FAQ:
https://docs.python.org/2/faq/design.html#why-doesn-t-python-have-a-with-statement-for-attribute-assignments

I consider it bogus if we allow with to mean something like:
https://msdn.microsoft.com/en-us/library/wc500chb.aspx



More information about the Python-list mailing list