Live data from Hacker News

Sunsetting Python 2

python.org

621–630 of 733 posts

Re: Sunsetting Python 2

#621
post #120

Earlier quoted context omitted.

Somebody has done just that already, it’s easily googleable. Nobody really cares though - why would you purposefully tie yourself to an objectively-inferior featureset, full of problems that have already been solved in py3? Because you can’t bear the use of parentheses for print, really?

> Because you can’t bear the use of parentheses for print, really? While I generally share your POV, it doesn’t do justice to the situation to trivialize the upgrade like that. Anyone with C based dependencies will have a rougher time (but not that “rough”) due to ABI changes. The harder userland change is string handling anyway (which isn’t that hard either), not parens on print.

...and those parenthesis are annoying as hell. :)

Re: Sunsetting Python 2

#622
post #365

Earlier quoted context omitted.

Right, but in engineering it's kind of expected to get support for a version for at least 60 years. Software engineering is just really weird in that it moves so fast and nobody seems to care to break things.

What free things are supported for 60 years in engineering applications? Name one.

Fairly ancient Fortran compiles OK in open source compilers. Not quite 60 years old, yet, but it'll be there soon.

Re: Sunsetting Python 2

#623

Earlier quoted context omitted.

Anyone with a large python 2 codebase is going to want to stay behind if they could. People still run old FORTRAN from 20 years ago in production. I'm sure some old COBOL code is out there. The reality of not wanting to re-write working code is somewhat real.

This is such a good analogy, and really highlights the point that python 2 stalwarts look at organizations hiring for FORTRAN and COBOL today, and say to themselves, "Yes, this is the kind of organization I want to build." An organization that will either (most likely) be completely irrelevant in 10 years time or have to pay a massive premium salary for any engineer that can maintain their systems.

Not only are there scientific disciplines where modern Fortran is still dominant, but there isn't much of a salary premium for working there.

And people said what you said about it 10 years ago. And 20 years ago. And 30 years ago.

When those folks want to do scripting, they mostly use Python. And they mostly use Py3, from what I can see.

Re: Sunsetting Python 2

#624

Earlier quoted context omitted.

Anyone with a large python 2 codebase is going to want to stay behind if they could. People still run old FORTRAN from 20 years ago in production. I'm sure some old COBOL code is out there. The reality of not wanting to re-write working code is somewhat real.

Are people routinely still purposefully writing new code in 20 year old versions of FORTRAN, or just maintaining existing stuff?

it's not on purpose, it's out of necessity. For example, a company has a huge COBOL code base. It plans to migrate to say, python. After 2 years of analysis, and some failures, they realize how much their organisation is driven by the software. So they decide to change their business processses. Another two years of analysis. Now they start rewriting again. After one year, they realize the consluting company responsible for the rewrite is screwing them, they stop the effort. New management comes in : "we need to put more resources in marketing, so we put all IT efforts on hold for two years". Now marketing needs data about its customers, so they ask the IT team to build some reports. This implies coding new stuff in COBOL, after 5+ years...

That's what I'm in right now :-)

Re: Sunsetting Python 2

#625
post #522

Earlier quoted context omitted.

Quick: run a shell command, split up the reply by line, run a regex on each line, and save the results to a yaml file— now, does what you wrote work correctly on both Python 2.7 and Python 3.3+? Yeah that's what I thought. It's still hard to get bilingual Python correct today, and it was considerably harder before 3.3.

Okay, I did it. import subprocess import re import yaml output = subprocess.check_output(['ls', '-l'], universal_newlines=True) matching_lines = [] for line in output.splitlines(): if re.search(r'total', line): matching_lines.append(line) with open('matching_lines.yaml', 'w') as f: f.write(yaml.dump(matching_lines)) Python 3.7: https://repl.it/repls/PotableDamagedAutocad Python 2.7: https://repl.it/repls/OrchidDirtyN…

[deleted]

Re: Sunsetting Python 2

#626

Earlier quoted context omitted.

I use Calibre as my primary e-book reader. I don't see many alternatives on Linux.

I basically use Calibre ebook viewer for its configurability and customization. If you want a good ebook reader, give Foliate ( https://github.com/johnfactotum/foliate ) a try. That and Bookworm ( https://github.com/babluboy/bookworm ) are the best standalone ebook readers I've seen in Linux.

Other than having a simpler layout I don't really see either as better than calibres reader. What's better other than looks?

Re: Sunsetting Python 2

#627

My new Mac laptop in 2016 came installed with Python 2.7 from Apple. It's that kind of subtle defaults that I think slowed the transition. I didn't want to change the system Python.

Apple will (eventually) entirely remove Python:

https://developer.apple.com/documentation/macos_release_note...

Hopefully they will fix the shitty keyboard before that happens, so I can finally replace my old Macbook Pro.

Scripting Language Runtimes

Deprecations

Scripting language runtimes such as Python, Ruby, and Perl are included in macOS for compatibility with legacy software. Future versions of macOS won’t include scripting language runtimes by default, and might require you to install additional packages. If your software depends on scripting languages, it’s recommended that you bundle the runtime within the app. (49764202)

Use of Python 2.7 isn’t recommended as this version is included in macOS for compatibility with legacy software. Future versions of macOS won’t include Python 2.7.

Re: Sunsetting Python 2

#628

Earlier quoted context omitted.

Out of curiosity, what is it that you like about Python 2? Not attacking you, just curious. I've never used Python professionally (mostly Ruby and Clojure), so I don't have a horse in this race.

I just realized I didn't answer your actual question, sorry. > what is it that you like about Python 2? I came from C and Pascal so from that POV Python is a rich and delicate syntactic and semantic gravy over the same basic functionality plus shell (Python was originally the shell language of the Amoeba distributed OS†). Things that might not seem that big a deal these days were a revelation to me when I started wit…

While I agree with most of your points, nothing you said really highlights why python2 is better than python3.

(Also, you're definitely not fucked with more than 100k LOC of Python, if the devs know what they're doing. Unit/regression/integration tests, type hinting, and a modular design goes a very long way)

Re: Sunsetting Python 2

#629

Earlier quoted context omitted.

The Py3 string handling was beyond frustrating prior to 3.6. For what I do, Unicode complexity is not required. Having to stuff it into everything was more trouble than it was worth.

The ubiquity of emoji alone mean that Unicode is everyone's problem in 2010+, and ignoring it won't make it go away. It's Python 2.x where dealing with Unicode (which is everywhere) is far too complex, and more trouble than it is worth. The "complexity" of Python 3 string handling is worth it, and no worse (even < 3.6) than any other modern programming language, and possibly easier than some by making clear runtime e…

Python 3's Unicode handling is uniquely bad. I haven't heard of any other language where you can obtain magic strings that crash the program if you try to print them:

    % python3.7 -c "import sys; print(sys.argv[1])" "$(echo -e '\xff')"           
    Traceback (most recent call last):
      File "", line 1, in 
    UnicodeEncodeError: 'utf-8' codec can't encode character '\udcff' in position 0: surrogates not allowed

Re: Sunsetting Python 2

#630

Earlier quoted context omitted.

I heard several people saying that 3.6 was the first Py3 worth transitioning to. Largely for async (I think async/await came to live then). There is this take on performance: https://hackernoon.com/which-is-the-fastest-version-of-pytho...

Ordered dicts and f-strings are also very sweet!

https://docs.python.org/2/library/collections.html#collectio...
Post reply on HN