Re: Finalizing Fedora's Switch to Python 3

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

 



On 28 July 2017 at 20:48, Colin Walters <walters@xxxxxxxxxx> wrote:
> On Thu, Jul 27, 2017, at 12:07 PM, Miro Hrončok wrote:
>
>>   * Switch /usr/bin/python to Python 3 in cooperation with Python upstream.
>
> That again?  That really seems like a nonstarter; previous
> discussion specifically around Atomic Host + Ansible:
> https://lists.fedoraproject.org/archives/list/devel@xxxxxxxxxxxxxxxxxxxxxxx/thread/T4PGIEUYXWXSDRVWYQ2BJXCECL45XWVW/
>
> Plus just breaking everyone's random old scripts.

Option 1: *guarantee* breaking old scripts by removing
"/usr/bin/python" entirely (current status quo on Py3-only Fedora
systems)
Option 2: keep such scripts working *if* somewhere in the *decade*
since Python 3 was released, folks accepted that Python 2 really was
going to go away, and modernised their code to run in the common
subset of Python 2.7 and 3.6+ (which covers a *lot* of Python 2.7's
capabilities, especially if you do "from __future__ import
print_function" rather than relying on the old print statement syntax)

Corollary to option 2: for as long Fedora ships a Python 2.7 stack, we
should provide a supported mechanism (building on either modularity,
xdg-alternatives, or both) that makes it straightforward for system
administrators to switch "/usr/bin/python" back to referring to Python
2.7

> Now, I
> don't know if this has been discussed upstream, but one
> thing to do possibly would be to have an interactive shell
> alias for `python` = `ipython3` or something like that, and
> switch `ipython` to `ipython3`.

User level aliasing isn't the issue - there are already several
solutions for that, and users are free to pick whichever one works
best for them.

It's only /usr/bin/python itself that still presents an unsolved
problem, since the status quo (not providing it at all) is even more
user hostile than pointing it at a modern version of Python 3 that
includes the various changes aimed at increasing the size of the
common subset of Python 2 & 3 (e.g. explicit unicode literals in 3.3,
binary codecs in 3.4, binary mod-formatting in 3.5, Fedora's backport
of implicit locale coercion to 3.6).

The most common Py2-induced syntax errors (print without parentheses,
print redirects using the old syntax) have also gained or are gaining
much improved error messages in 3.6.x (such that the error also
suggests directly how to fix it), and there are various other things
we can consider to help smooth the transition (like providing the
"six" and "future" compatibility modules by default in both our Python
2 and Python 3 stacks in order to make portable hybrid code easier to
write).

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan@xxxxxxxxx   |   Brisbane, Australia
_______________________________________________
devel mailing list -- devel@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxxxxxxxx




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Fedora Announce]     [Fedora Kernel]     [Fedora Testing]     [Fedora Formulas]     [Fedora PHP Devel]     [Kernel Development]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Gimp]     [Yosemite News]
  Powered by Linux