Hacker News new | past | comments | ask | show | jobs | submit login

Less syntax in languages, please. The problem with the Perlish "There's more than one way to do it!" is that one ends up expending extra cycles comprehending semantic equivalence. But equivalence should be a fulcrum -- these are things leveraged to be able to reduce the effective complexity of what we're looking at. Anything that obscures the visibility of equivalence is bad on the balance.



If your language allows both (+ 1 2) and (+ 2 1) then there's more than one way to do it. There's always more than one way to do it. That's just the nature of languages. Even in pure arithmetic, both 1.99999… and 2 represent the same number. It's inescapable. The point isn't "let's only have one way to do it." The point is to have One Obvious Way To Do It. And that's the Python motto. What this article is doing is showing the mappings between the way you might be used to from other languages to the preferred One Obvious Way of Python.

Decrying syntax is nuts. Humans work better if they can pick out visually what's going on. Even Lisp people indent their ifs and defuns. (And if Lisp doesn't have syntax, what the hell do ' or # or (in Arc) [] do?) Now, if we have to have at least a little syntax it's also nice if it's easy to pick out from the visual impression of the syntax what it is that the programmer is getting at. In my opinion, Python does a great job of this.


(+ 1 2) vs (+ 2 1) is a far cry from "map(lambda x: x * x, numbers)" versus "[x * x for x in numbers]".

I call straw man. I am not asking for zero syntax, or that everything be done in Scheme.

For one thing, I'm not a Lisper, which you think I am. For another thing, Lisp has syntax, so you are incorrect. For yet another thing, I am decrying Too Much Syntax that encourages too many ways of doing things, not taking a dogmatic stand for absolute syntactic minimums. True one cannot make a syntax so pure that there is only one way of doing something. That's a straw man. But on the other hand, one can make a syntax so complicated that it seems to strongly encourage doing the same thing in many ways. Perl and Ruby are guilty of this. Python not nearly as much, but still more than I would like.

Syntactic constructs are a tool. Tools have overhead. Why have redundant syntactic tools? It's enough to get one's head around the problems to be solved.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: