News for hackers. Stuff that matters.
Re:The PEPs of Python 3.9 by cesarb on Thursday May 28, 2020 @03:32PM (#23341472)
> Or, alternatively, "How many Python 2 scripts will run on a Python 3 interpreter?" Answer: "None of them."

That's obviously untrue. For example, consider the following Python 2 script:

    with open('a.txt', 'r') as a, open('b.txt', 'w') as b:
        for line in a:
            b.write(line)
It works identically on a Python 3 interpreter, and it doesn't even use "from __future__ import ...".
Re:The PEPs of Python 3.9 by romanvm on Thursday May 28, 2020 @11:44PM (#23346076)
Not quite. If your a.txt contains utf-8 byte blocks you are screwed in Python 2.
Re:The PEPs of Python 3.9 by downerending on Thursday May 28, 2020 @03:44PM (#23341657)
Yes, I should have said, "a vanishingly small proportion, and even then mostly by accident".

My guess is that if you sweep GitHub for Python2 code and push it into Python3, that proportion would be under one percent.

Re:The PEPs of Python 3.9 by tuco86 on Thursday May 28, 2020 @07:41PM (#23344468)
how will that number look when you first autoconvert via 2to3?

I did two migrations of >500k loc projects in an afternoon each, and admittedly some days of testing to gain confidence since there where few unit test. But i found it to be very smooth sailing.

I was very familiar with both projects, so that helped a lot.

EDIT: I also want to add that i did this using python3.5, when to ecosystem seemed to be at a sweet spot of dependencies supporting both 2 and 3 mostly. I guess if one has been waiting until now, the divide between library versions will be a lot bigger.

Re:The PEPs of Python 3.9 by mixmastamyk on Thursday May 28, 2020 @04:18PM (#23342062)
As a big user of logging and little to do with character coding, all of my admin/daemon stuff moved over with almost no changes necessary for 3.0 (actually ~3.3).

For some projects I did bigger refactors for 2.6/7 (exceptions) and 3.6 (fstrings).

Re:The PEPs of Python 3.9 by a1369209993 on Thursday May 28, 2020 @08:13PM (#23344752)
Fair point, but:

  int main(int c,char** v)
    {
    printf("Hello, World!\n");
    return 0;
    }
doesn't make C++ the same language as C.