what does := means simply?

bartc bc at freeuk.com
Thu May 17 10:50:17 EDT 2018


On 17/05/2018 15:03, Chris Angelico wrote:
> On Thu, May 17, 2018 at 9:58 PM, bartc <bc at freeuk.com> 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.
>>
> 
> Python DOES guarantee it, and nobody cares about your personal toy
> language other than you. :)

As I said, it's poor form.

Of course, full-on Python code is pretty much impossible to port 
anywhere else anyway.

-- 
bartc



More information about the Python-list mailing list