2 ms·
Python's syntax also rattles me for the same reason. [item for item in items if item.include] It's almost exactly like a sql statement. The order is confus
by throwaway13337 3y ago
Python's syntax also rattles me for the same reason.
[item for item in items if item.include]
It's almost exactly like a sql statement.
The order is confusing.
More broadly, foreach loops are also written in the wrong order.
More reasonable:
foreach(items as item)
In the West, we read left to right. Presenting undefined terms before defined ones burdens the mind.
- dylan604 3y agoI !loved the coding style of (9 == $a) to protect against the common error of ($a = 9)
- rangerelf 3y agoSpeak for yourself, I've always loved Python's list comprehension syntax, it makes ALL the sense. For ME. It's a question of ergonomics, just like my favorite chair is not going to be your favorite chair for whatever reason, programming language constructs that bug you doesn't mean it'll bug anyone else. Your foreach() example bugs the hell out of me, for example. But I'm not campaigning to have it erased from existence, I just don't use languages that model their syntax like that.
- tmp_eSGPhx 3y agoagreed it is personal; this python snippet is an example that I've always had a distaste for, but which others love foo = 1 if true else 0 I think this was designed because most of the time foo should equal 1, and they want the code to highlight the default. I don't like it because reading left to right it takes a few characters to realize it is a branching statement.