lilypond-devel
[Top][All Lists]
Advanced

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

Re: Python 3 (was: 2.20 where are we?)


From: Matthew Peveler
Subject: Re: Python 3 (was: 2.20 where are we?)
Date: Mon, 30 Sep 2019 18:09:38 -0300

On Mon, Sep 30, 2019 at 5:46 PM Joram <address@hidden> wrote:

> Am 27.09.19 um 22:34 schrieb Matthew Peveler:
> > long vs int, unicode vs str, StringIO vs io, iter.next vs
> > iter.__next__, reload, xrange vs range.
>
> It is very well feasible to support both version. I hope by shims you
> mean something like¹
>
>     from __future__ import division, print_function
>     from builtins import range
>
> because there is no need to customly write those. I consider the link
> quite helpful.
>
> Cheers
>
>
> ¹ https://python-future.org/compatible_idioms.html


Yes for using __future__, but no for builtins  while it would make things
easier, it is not something that is actually built into python and would be
installable for PyPI via the future package (
https://pypi.org/project/future/). So I had to hand define the shims,
though I mostly went for

python2 -> python3 shim such:
if sys.version_info > (3,):
    xrange = range
    raw_input = input

as I dislike overwriting builtin functions/variables if I can avoid it as
it leads to potentially surprising behavior, though reversing that would
not be very difficult if so desired.

Matt


reply via email to

[Prev in Thread] Current Thread [Next in Thread]