What does colon equal (:=) in Python mean?

后端 未结 5 1857
-上瘾入骨i
-上瘾入骨i 2020-12-05 12:59

What does the := operand mean, more specifically for Python?

Can someone explain how to read this snippet of code?

node := root, cost =          


        
5条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-05 13:01

    PEP572 proposed support for the := operator in Python to allow variable assignments within expressions.

    This syntax is available in Python 3.8.

提交回复
热议问题