3 ms·
Awful syntax. If then =?, not =: which already is the pascal assignment and perl binding operator.
by rurban 8y ago
Awful syntax. If then =?, not =: which already is the pascal assignment and perl binding operator.
- cyphar 8y agoI think it was meant to mirror the Go syntax? Or maybe they both came to the same decision. Personally I think it looks "wrong" for Python (which has for better or worse always opted for word-based syntax), but I disagree that it's awful.
- Annatar 8y agoWelcome to Python, where proponents will proudly claim that the language is easy to read and intuitive. I was reading the discussion above, where they argue whether a statement like if (foo := check_foo()): do_foo() is readable. The entire time I’m thinking Willis. Tango. Foxtrot! This is the kind of stuff us C / AWK programmers do all of the time precisely because it’s concise, elegant and intuitive (not to mention well understood), and these guys are struggling since it turned into a huge discussion. Made me wonder if we’re in a programming kindergarten here or what?
- int_19h 8y agoThis is also the kind of stuff that you C programmers write bugs with all the time, by mistaking = with ==; to the point where most C compilers these days would just flag something like if(a=1) as a warning with default settings. Really, all this mess is the legacy of poor choice of = and == as operators back in C (or rather, B). Pascal really had it right with the assignment being very distinct from comparison, such that it's pretty much impossible to confuse the two. The sole reason for that design decision in C, so far as I know, was that assignments occur slightly more often than comparisons, and so they wanted it to be a single character. But I seriously doubt that it was worth all the bugs.
- Annatar 8y ago“This is also the kind of stuff that you C programmers write bugs with all the time, by mistaking = with ==; to the point where most C compilers these days would just flag something like if(a=1) as a warning with default settings.” No it isn’t; we’re not beginners. I learned Pascal before I learned C. Hated the retarded := as superflous.
- pseudalopex 8y agoIf that were true, exist Yoda conditions would not.
- int_19h 8y agoThis is an assignment operator, so why shouldn't it use an established syntax for an assignment operator?