Alan Bawden
2024-09-02 07:55:15 UTC
Python 3.10.5 (v3.10.5:f37715, Jul 10 2022, 00:26:17) [GCC 4.9.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
Now I didn't expect the following to work (but Python sometimes
x,2,z = [1,2,3]
^^^^^^^^^^^
SyntaxError: invalid syntax. Maybe you meant '==' or ':=' instead of '='?
Yeah, that makes sense, no surprises today... Except "maybe you meant
'=='..." caught my attention. _Could_ that be what someone would want
Now that made me laugh.
- Alan
[ Some people reading this will be tempted to explain what's really
going on here -- it's not hard to understand. But please remember that
a joke is never funny if you have to explain it. ]
Type "help", "copyright", "credits" or "license" for more information.
x,_,z = [1,2,3]
Works as expected.Now I didn't expect the following to work (but Python sometimes
x,2,z = [1,2,3]
File "<stdin>", line 1x,2,z = [1,2,3]
^^^^^^^^^^^
SyntaxError: invalid syntax. Maybe you meant '==' or ':=' instead of '='?
Yeah, that makes sense, no surprises today... Except "maybe you meant
'=='..." caught my attention. _Could_ that be what someone would want
x,2,z == [1,2,3]
(1, 2, False)Now that made me laugh.
- Alan
[ Some people reading this will be tempted to explain what's really
going on here -- it's not hard to understand. But please remember that
a joke is never funny if you have to explain it. ]