Glenn Linderman writes:

 > Mathematics never came up with separate symbols for equality and
 > assignment.

Mathematics doesn't need them, until we come to an age where we do
mathematics on algorithms.  It's perfectly possible to do algebra
interpreting "let x = 3" as an equation of the form "f(x) = g(x)"
rather than an assignment.

 > In your example "solve c = f(x) for x", that is not an assignment 
 > operator, but an equality comparison operator in an equation.

But "=" is sugar, not syntax, in the "let" form, and although it is
syntax in the "solve" form, in both cases it is the keyword "let" or
"solve" that denotes assignment.  So "solve c = f(x) for x" *can* be
interpreted as an assignment to x.

 > But note that your example is wordier than "let c = f(x)" which
 > would be an assignment operation. And note that it _needs to be
 > wordier_ to convey the proper mathematical semantics.

Wordiness in defense of readability is no sin, at least not in Python.
:-)  In exactly the same way as you describe for the "solve" example,
a destructuring pattern match is necessarily wordier than simple
assignments to the component variables would be.  So I don't see an
issue here.

 > Just because something is syntactically unambiguous, doesn't mean it 
 > makes a good user interface.

I didn't (and don't) argue it does.  I argue it works for me, and if
it works for Guido too, I refuse to feel bad about that. ;-)  If it
doesn't work for a large majority of people who would use pattern
matching in Python, who would want to destructure "Point(x=a,y=b)",
it's bad UI.  I don't know that's true yet, so I want to oppose false
statements like "there's no analogy to this" (which is not quite what
Jim said).

Tastes differ, those differences are valid, and to some extent the
majority rules here (although I've seen in the past that some folks
are much better judges of *future* majorities than others! ;-)

Steve
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/VSH35V3QZZPIPDCMY76NWKV35JSITUUQ/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to