what does := means simply?

Tobiah toby at tobiah.org
Thu May 17 10:20:57 EDT 2018


On 05/16/2018 08:54 PM, Steven D'Aprano wrote:
> On Thu, 17 May 2018 05:33:38 +0400, Abdur-Rahmaan Janhangeer wrote:
> 
>> what does := proposes to do?
> 
> Simply, it proposes to add a new operator := for assignment (or binding)
> as an expression, as an addition to the = assignment operator which
> operates only as a statement. The syntax is:
> 
>      name := expression
> 
> and the meaning is:
> 
> 1. evaluate <expression>
> 
> 2. assign that value to <name>
> 
> 3. return that same value as the result

Well, that would be a welcome addition!





More information about the Python-list mailing list