[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: still fixing stuff the upgrade broke...



On Fri 07 Jan 2022 at 08:43:48 (-0500), Dan Ritter wrote:
> David Wright wrote: 
> > On Thu 06 Jan 2022 at 07:24:47 (-0500), Dan Ritter wrote:
> > > pytnon-is-python2
> > > 
> > > python-is-python3
> > > 
> > > Either way, something's going to break. Blame Guido Van Rossum.
> > 
> > Throughout those years, Python3 was available, and there were
> > compatibility layers and cheatsheets assisting with or documenting
> > the production of compatible code or its conversion for deployment
> > when upgrading. Makes no difference to human nature.
> > 
> > So I think any blame should be shared around a lot more.
> 
> I don't mean that the Python directors should have mandated
> harder or gone out to fix the software themselves.
> 
> I mean that this could all be avoided if the language spec
> started with
> 
> "Python interpreters that handle major version 3 must be invoked
> under the name python3. A python3 interpreter is not required to
> handle Python 1 or 2 syntax. If it does not, it must terminate
> execution as soon as possible with an error message like 'This
> program needs a different major version of Python."

But that would prevent you being able to distribute programs that
really don't care which version they run under because their code
has been crafted to handle both Python2 and Python3.

My experience is that python3, trying to run Python2 code naïvely,
gives:

SyntaxError: <what the specific error is> <optional fix suggestion>
eg:
>>> print 3
    print 3
          ^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(3)?
>>> False = 0
SyntaxError: can't assign to keyword
>>> 

Absent a shebang, how can the Python3 interpreter distinguish
between an author who wrote, say,   print 3   simply because of
finger-memory, from one who intended to write in Python2 code.
And, of course, anyone can issue   python3 <Python2-code>
if they feel like it, and contradict any shebang.

> Not having that in the spec as soon as they made the decision
> that Python 3 would break compatibility, that's what I blame
> them for.

The business of how the python/python2/python3 commands are
implemented is not in the hands of the the Python authors,
but distributions like Debian/ubuntu/arch etc. My opinion is
that some distributions showed undue haste in changing over
to python→python3, leaving people running third-party Python2
code in a difficult position. I would still not rely on bare
python to give me python3—I can't see the point.

Cheers,
David.


Reply to: