Hacker News new | ask | show | jobs
by zahlman 589 days ago
The usual argument is that bracketed syntax rather than indentation-based syntax makes it possible/easier to have multi-line anonymous functions (such as with Ruby's block syntax), and especially to use them within more complex expressions.

Pythonistas generally consider that a misfeature.

1 comments

You can have indentation based syntax and ; for multiple statements in one line, or something even more powerful. But it doesn't matter.

Main power of blocks is not being multiline or being closure-like, many languages have this. But blocks are not just anonymous functions or lambdas, they have ability to return from the outer method (or from the method to which it was passed with break), acting as a powerful tool for creating your own flow control structures if needed, or just replacing "for". Of the languages I know or heard of only smalltalk does the same.

You can live without those, you can live even without early return, but blocks are not a misfeature, it's a great and intuitive tool. And python's rudimentary lambdas make me cry a little.