←back to thread

317 points est | 1 comments | | HN request time: 0.204s | source
Show context
amelius ◴[] No.17448876[source]
If they add anything to Python, it should be the ability to do functional-style programming without hassle. Right now it's almost impossible to compose functions in an inline style such as used in functional programming languages. Yes, there's lambda, but it doesn't extend into multiple lines, and applying a function to a bunch of lambdas directly leads to line-width overflow. Even JavaScript has better support for functional-style programming. Perhaps Guido should spend a year writing Haskell :)
replies(8): >>17448904 #>>17448927 #>>17448972 #>>17449048 #>>17449482 #>>17450517 #>>17450691 #>>17451251 #
bjoli ◴[] No.17449048[source]
I wonder what would break if they started treating if as an expression. It is much nicer to do:

    def foo(X):
        if bar(foo):
            1
            False
replies(3): >>17449102 #>>17449137 #>>17450511 #
1. amelius ◴[] No.17449137[source]
I once wrote a (simple) compiler for a language exactly like that, i.e. LISP-type with indentation replacing parentheses. However, I found that this style becomes too complicated, because for long functions you can't easily see which parts have the same indentation. Perhaps special editor-support would help.