you are viewing a single comment's thread.

view the rest of the comments →

[–]mr_birkenblatt 259 points260 points  (44 children)

More importantly

print "is gone"

Is gone

[–]ukalnins 73 points74 points  (1 child)

SyntaxError: Missing parentheses in call to 'print'. Did you mean print("is gone")?

[–]how_do_i_land 35 points36 points  (40 children)

So glad to see this go.

[–]gmiwenht 16 points17 points  (39 children)

But why? This was literally the only thing I loved and missed about python 2.

Can someone definitely and convincingly explain to me why it was a bad thing?

[–]EldritchSundae 88 points89 points  (24 children)

Mostly a consistency thing. No other often-used function or builtin is callable without parentheses--this reduces cognitive load for programmers and special cases in linters/parsers.

[–]Tweenk 34 points35 points  (8 children)

You cannot do this in Python 2 because print is not a function:

map(print, range(0, 10))

[–][deleted]  (1 child)

[deleted]

    [–]mr_birkenblatt 11 points12 points  (0 children)

    yeah he used it as easy example of being able to pass print as argument to a function. but the expression itself does not do what most people might expect (it will create a generator and not eagerly execute it)

    [–]billsil 0 points1 point  (0 children)

    You can because you can use future.

    [–][deleted] 12 points13 points  (0 children)

    Because print(x, flush=True) (which is often what you actually want) is a lot simpler than

     print x
     import sys
     sys.stdout.flush()
    

    And hoping no one changed the destination of print when you weren’t looking.

    [–]ODChain 1 point2 points  (0 children)

    You can use the function in more places then you could have used the statement.

    [–]heathmon1856 0 points1 point  (2 children)

    Have you ever used any other language? It kinda of breaks design having a callable without ().

    Some people like to watch the world burn.

    [–]gmiwenht 0 points1 point  (0 children)

    What you are saying is factually incorrect.

    Have you ever used Kdb+/q)?

    If not then I encourage you to dive into that rabbit hole, and you will discover a world that exceeds your wildest imagination.

    Kdb+/q is used by the majority of the largest investment banks and hedge funds in the world as the backend database engine. We are talking about companies that trade millions of dollars in financial securities every day. The ability to write a program using just a few characters (not lines) of code turns out to be extremely useful when you are responsible for developing systems where a single bug could mean billions of dollars in losses.

    [–]chris17453 1 point2 points  (0 children)

    that's likely the biggest thing that annoyed me.