[Python-ideas] Dart-like method cascading operator in Python
Nick Coghlan
ncoghlan at gmail.com
Thu Nov 21 23:19:44 CET 2013
On 22 Nov 2013 05:11, "Masklinn" <masklinn at masklinn.net> wrote:
>
> On 2013-11-21, at 18:26 , Andrew Barnert <abarnert at yahoo.com> wrote:
> > Is it really that hard to name a plot "p"? Is typing “p.", or reading
it, more work than ".."?
>
> What’s the point of anything then?
>
> p = gnuplot.newPlot()
> p.set(‘xrange [0:5]’)
> p.set(‘xrange [0:20]’)
> n = p.newPlot()
> n.addSeries(“Linear”, [1, 2, 3])
> n.addSeries(“Quadratic”, [1, 4, 6])
> p.run()
>
> is terser and adds no more pressure to the local namespace, the only
> loss is the pseudo-nested formatting and that’s not really a core goal
> of cascading.
If a statement local namespace is the goal, then see PEPs 403 and 3150.
Given the problems with those, this far more limited suggestion has even
less chance of approval.
Cheers,
Nick.
>
> > So if this is any part of the argument for the proposal, I'm -1.
>
> As far as there’s any interest to cascading it’s that it’s terser
> than sequencing calls with explicit receivers, and that it’s an
> expression allowing inline initialisation sequences and not requiring
> creating a binding.
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20131122/34d0cc5f/attachment.html>
More information about the Python-ideas
mailing list