Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I am still aware of a Python 1.6 codebase in daily mission critical use. That's 'good enough' for them too. Is Python 2 worth the effort?

Probably because of the ecosystem. And that will be when everyone transitions to Py3, when stuff they want to use is Py3 only.



A head-to-head comparison of 1.6 against 2.7 and 2.7 against 3.5 will quickly make it clear it's not the same thing. Python 2.7 is not only "good enough" by itself, there's also no compelling reason to move to 3. Bad incentives from both directions. I wouldn't necessarily say Py3 is inferior as the author wondered, it's just insufficiently superior, and not having Library X available for years is just an additional thorn in the side of people attracted to Python in the first place for the ability to get stuff done that's still readable years later. Py3 really just doesn't offer anything killer for tons of programmers. Things that would have appealed to me: massive performance increases, or a worthwhile standard library improvement, or an impressive syntax upgrade, and only by migrating can you get those nice things... Some other people get hot for static typing too, so I guess they might finally be happy.

This always bugged me about Python:

    >>> exit
    Use exit() or Ctrl-D (i.e. EOF) to exit
You know god damn well what I mean Python, so just do it instead of nitpicking me. Python 3 doesn't fix this, and makes it worse. Case in point (using a web repl as I'm not at a computer with Py3 on it at the moment):

    >>> range 4
    Traceback (most recent call last):
      File "python", line 1
        range 4
              ^
    SyntaxError: unexpected EOF while parsing
Okay, reasonable enough...

    >>> print 4
    Traceback (most recent call last):
      File "python", line 1
        print 4
              ^
    SyntaxError: Missing parentheses in call to 'print'
You know god damn well what I mean, Python. You know what you could have done to have your precious sys.stdout.write(repr(arg) + "\n"[, extras]) as a smaller replaceable built-in function that wouldn't break everyone and make them sad? Called it Echo. Puts. Print3. Println. Nope, just breaking the most basic things, for no real good reason since it's not like Python is going the Lisp route of killing the distinction between statement/expression in favor of everything being an expression.

    //rant


    >>> exit
    Use exit() or Ctrl-D (i.e. EOF) to exit
> You know god damn well what I mean Python, so just do it instead of nitpicking me

Python has no idea that's what you mean.

    >>> repr(exit)
    'Use exit() or Ctrl-D (i.e. EOF) to exit'
It's just the exit function has a __repr__ that returns that. Why the hell would Python make just 'exit' exit the interpreter? That's unlike anything else in the language.

    >>> print 4
    SyntaxError: Missing parentheses in call to 'print'
This is a special case to help with the transition from 'print' to 'print()'. Should 'i 1' have a message saying a parenthesis is missing? I could mean 'i + 1', or 'i, 1'.


"range 4" is a syntax error in Python 2 as well.

Meanwhile...

    #include<stdio.h>
    
    int main(void) {
        printf "Hello World\n";
        return 0;
    }

    hello.c:4:9: error: expected ';' after expression
      printf "Hello World\n";
            ^
            ;
    hello.c:4:3: warning: expression result unused [-Wunused-value]
      printf "Hello World\n";
      ^~~~~~
    hello.c:4:10: warning: expression result unused [-Wunused-value]
      printf "Hello World\n";
             ^~~~~~~~~~~~~~~
    2 warnings and 1 error generated.
You know god damn well what I mean, C, so just do it instead of nitpicking me!


Honestly after using Scala for 3 or 4 years I couldn't go back to a language that doesn't allow an "object method argument" style of doing method calls. Superficial perhaps, but it can make code so much more readable.


> //rant

Sorry I hit a nerve. You insisted it 'wasn't the same' but didn't give an example.

If you don't need what Py2 provides, I don't know why it wouldn't be 'good enough'. And since I built a lot of complex stuff in Py1, I can't imagine why anyone would think it is not good enough for building complex stuff.


I find it challenging to accept the humanity of the person that thought breaking print was a jolly good thing to do.


When I moved to Py3, it was the thing that got me most often. It was annoying. But three things changed to make that less annoying:

1. I got used to it, fairly quickly. That made me care less.

2. I used print-statement debugging less, and unit tests more. This was a good thing generally.

3. For those times when I did need print to debug, I found I could drop in pprint:

    import pprint
    print = pprint.pprint
which is very useful. That won me over.

I've rarely needed naked print to do anything but quick testing and debugging (because by the time I have a command line script, I want at least to have a -q option, so I need to run output through some kind of proxy function). The standard arguments for print() (i.e. composability, extra arguments), I've not needed, but the ability to replace it, I rely on totally now.

Of course, YMMV, this is just my experience.


See http://www.snarky.ca/why-print-became-a-function-in-python-3 for the reasoning behind making `print` a function.


python prompt isn't much of a development shell, use ipython it lets you type exit and if you turn on autocall (%autocall) it lets you run functions without parens(hint this isn't valid python).

print isn't a statement in python 3 and range was never a statement




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

Search: