Yes, and if we're lucky we can get to that point without as much work as
sympy, since we don't have as much code.

The 2to3 tool can do selective changes like change print "" to print("")
and fix exception syntax, which are compatible with 2.7.

It can also do things like change "a = dict.iteritems()" into "a =
dict.items()" which changes the memory usage when run on 2.7. These
differences can instead be resolved by using the python module "six" which
implements cross-compatible helper functions for a lot of things.

Btw when we switch we should go straight to python 3.3-3.4.
Supporting 3.0-3.2 side by side with 2.7 is apparently harder.

(Note to Aslak: read the link from Jan!)

Martin


On 22 May 2014 11:22, Jan Blechta <[email protected]> wrote:

> Note that there is also an approach of having simultaneously 2.x and 3.x
> compatible codebase without a need of using 2to3. Allegedly, this is
> used in SymPy, NumPy and SciPy projects. See
>
> http://ondrejcertik.blogspot.cz/2013/08/how-to-support-both-python-2-and-3.html
>
> Jan
>
>
> On Thu, 22 May 2014 11:05:43 +0200
> Martin Sandve Alnæs <[email protected]> wrote:
>
> > The plan for the initial work here is to keep the code python 2.7
> > compatible but ready for a later swift switch to 3 only. I suggest we
> > release fenics 1.5 with python 2.7 compatibility intact but
> > convertible to python 3 by just running py2to3. Otherwise there will
> > be too much simultaneous breakage. Then we can discuss whether we
> > leave python 2.7 behind in fenics 1.6 or not.
> >
> > However, I haven't thought about the swig side in dolfin, and as Johan
> > mentions keeping the Python CAPI code compatible is not covered by
> > py2to3. I'll discuss this with Johan and Aslak.
> >
> > Martin
> >
> >
> > On 22 May 2014 10:49, Garth N. Wells <[email protected]> wrote:
> >
> > > Nice. Do we want to support Python 2.7 and 3, or would it be more
> > > sustainable to go all Python 3? My preference is for simplicity and
> > > low maintenance, which points to Python 3 only support.
> > >
> > > Garth
> > > On Thu, 22 May, 2014 at 9:39 AM, Martin Sandve Alnæs
> > > <[email protected]> wrote:
> > >
> > >> We have a summer intern at Simula, Aslak Bergersen,
> > >> who will work on preparations for python 3 support in FEniCS,
> > >> as well as some other FEniCS tasks, from late June and
> > >> throughout July.
> > >>
> > >> The preparations for python 3 involves mainly:
> > >> - Replacing ScientificPython for AD in FIAT
> > >> - Applying and committing backwards compatible parts of py2to3
> > >> - Replacing several functions such as dict.iteritems with
> > >> six.iteritems in UFL and possibly FFC to make sure we keep the
> > >> same performance and memory behaviour with python 2 and 3.
> > >>
> > >> I will be on vacation part of his time here so please
> > >> help him out if he has questions to the list.
> > >>
> > >> Martin
> > >>
> > >
> > >
>
>
_______________________________________________
fenics mailing list
[email protected]
http://fenicsproject.org/mailman/listinfo/fenics

Reply via email to