On Sun, May 13, 2018 at 7:33 AM, Ed Kellett
On 2018-05-12 19:27, Steven D'Aprano wrote:
What you probably want is the second version:
(a := c.d()).b(a)
which of course looks like utter crap. It might look better if we use at least half-way sensible variable names and a more realistic looking example, instead of obfuscated one-letter names.
(widget := widget_builder.new(*args)).method(widget)
I believe that that's missing the point: to wit, in
x.method(y)
is `x` or `y` evaluated first? I didn't know. I don't think the order is documented anywhere or guaranteed not to change. I don't know what other languages do in general, though I know in C it's explicitly unspecified.
It's documented. It's guaranteed not to change. https://docs.python.org/3/reference/expressions.html#evaluation-order ChrisA