On 11/05/18 11:14, Jacco van Dorp wrote:
2018-05-11 11:56 GMT+02:00 João Santos <j...@jsantos.eu>:
Optimizing syntax for space makes sense for "mathematical" notation since
it's commonly written by hand, but putting space above readability in a
programming language design feels like a skewmorphism.

You are assuming "given" to improve readability, where I stated ":= is
perfectly clear ", at least in my opinion. Therefore, since clarity is
already achieved, the rest is clutter that reduces readability.

I respectfully disagree with your opinion (i.e. you're wrong :-)

Consider:

  while (cmd := get_command()).token != CMD_QUIT:
    cmd.do_something()

vs:

  while cmd.token != CMD_QUIT given cmd = get_command():
    cmd.do_something()


I find I write code like this[*] a fair bit, since my major use for Python is to write remote monitors for embedded kit, so it's pretty much a real world example. I don't find the first version using ":=" to be perfectly clear, in fact I think it's rather ugly. That may be partly the same reaction that many of us had to the asymmetry of assignment expressions in (over-)complicated comprehensions. The second version using "given" reads much more naturally to the mathematician in me, and not too badly to my English half either.


[*] By "like this" I mean the clunky "while true:" spelling, obviously.

--
Rhodri James *-* Kynesim Ltd
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to