Message380580
#The 'Walrus' operator does not support multiple assignment but does not #flag an attempt to make a multiple assigment as an error
#This results in unexpected behavior at execution time:
a, b = 100, 200
print (a, b)
#result is
#100 200
if (a, b := 3, 4): #this should be flagged as an error but is not
print ("found true")
else:
print ("found false")
print (a, b)
#result is
#100 3 but if multiple assigment were allowed this would be '3, 4'
----------------------------------------------------------------------
Python 3.9.0 (tags/v3.9.0:9cf6752, Oct 5 2020, 15:34:40) [MSC v.1927 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license()" for more information.
>>>
= RESTART: C:\Users\John PC 2017\AppData\Local\Programs\Python\Python38-32\walrustest.py
100 200
found true
100 3
>>> |
|
Date |
User |
Action |
Args |
2020-11-09 10:48:14 | JohnPie | set | recipients:
+ JohnPie |
2020-11-09 10:48:14 | JohnPie | set | messageid: <1604918894.59.0.15180711596.issue42295@roundup.psfhosted.org> |
2020-11-09 10:48:14 | JohnPie | link | issue42295 messages |
2020-11-09 10:48:14 | JohnPie | create | |
|