what does := means simply?

bartc bc at freeuk.com
Thu May 17 07:58:43 EDT 2018


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.

-- 
bartc



More information about the Python-list mailing list