[issue35207] Disallow expressions like (a) = 42

Stefan Krah report at bugs.python.org
Mon Nov 12 08:31:43 EST 2018


Stefan Krah <stefan at bytereef.org> added the comment:

I just want to add one more voice for allowing the status quo:

C, OCaml, SML, Haskell allow the assignment, Ruby disallows it.

The ML family must allow it, since "let (x) = 10" is pattern matching
under the hood, and (10) = 10.

In C (gcc, clang at least, I didn't check the standard) it may be convenience.


Python's assignment unpacking is similar to pattern matching, so
while the construct is surprising at first, I think it's the right
thing to do.

----------
nosy: +skrah

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue35207>
_______________________________________


More information about the Python-bugs-list mailing list