On 17/05/2018 14:32, Steven D'Aprano wrote:
On Thu, 17 May 2018 12:58:43 +0100, bartc wrote:
On 17/05/2018 04:54, Steven D'Aprano wrote:
On Thu, 17 May 2018 05:33:38 +0400, Abdur-Rahmaan Janhangeer wrote:
what does := proposes to do?
A simple example (not necessarily a GOOD example, but a SIMPLE one):
print(x := 100, x+1, x*2, x**3)
It's also not a good example because it assumes left-to-right evaluation
order of the arguments. Even if Python guarantees that, it might be a
problem if the code is ever ported anywhere else.
Seriously? You think we have a responsibility to write examples which
will work with arbitrary languages with arbitrarily different evaluation
Okay, let's be clear:
- if the language has different evaluation order, it might not work;
That's right. The rest of your list either doesn't matter so much or is
only remotely likely.
Doing a certain amount of restructuring of an algorithm expressed in one
language in order to port it to another is expected. But relying on
evaluation order is bad form. Suppose this bit of code was imported from
elsewhere where evaluation was right to left?
Anyway, try this:
def showarg(x): print(x)
def dummy(*args,**kwargs): pass
This displays 2,3,1 showing that evaluation is not left to right.