←back to thread

317 points est | 1 comments | | HN request time: 0.21s | 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. Franciscouzo ◴[] No.17450511[source]
Pretty much everything that has an if statement would break, besides there already exists an if expression:

    'foo' if foo else 'bar'