← Back to team overview

ufl team mailing list archive

Re: [HG UFL] Reverted from future absolute_import to

 

2008/11/16 Johan Hake <hake@xxxxxxxxx>:
> On Sunday 16 November 2008 14:26:33 UFL wrote:
>> One or more new changesets pushed to the primary ufl repository.
>> A short summary of the last three changesets is included below.
>>
>> changeset:   412:4288af82148d16e15445f852479379f8da89acc2
>> tag:         tip
>> user:        "Martin Sandve Alnæs <martinal@xxxxxxxxx>"
>> date:        Sun Nov 16 14:26:35 2008 +0100
>> files:       ufl/__init__.py ufl/algebra.py ufl/algorithms/__init__.py
>> ufl/algorithms/ad.py ufl/algorithms/analysis.py ufl/algorithms/checks.py
>> ufl/algorithms/dependencies.py ufl/algorithms/formdata.py
>> ufl/algorithms/formfiles.py ufl/algorithms/formtransformations.py
>> ufl/algorithms/indexalgorithms.py ufl/algorithms/predicates.py
>> ufl/algorithms/printing.py ufl/algorithms/transformations.py
>> ufl/algorithms/traversal.py ufl/algorithms/ufl2latex.py
>> ufl/algorithms/variables.py ufl/base.py ufl/baseoperators.py
>> ufl/basisfunction.py ufl/classes.py ufl/conditional.py
>> ufl/differentiation.py ufl/elements.py ufl/finiteelement.py ufl/form.py
>> ufl/formoperators.py ufl/function.py ufl/geometry.py ufl/indexing.py
>> ufl/integral.py ufl/mathfunctions.py ufl/objects.py ufl/operators.py
>> ufl/restriction.py ufl/scalar.py ufl/split.py ufl/tensoralgebra.py
>> ufl/tensors.py ufl/variable.py ufl/zero.py description:
>> Reverted from future absolute_import to
>> normal import (using python script with regexp).
>>
>> Fixed a bunch of bugs and minor stuff
>> reported by pylint via pydev in eclipse.
>> (This works fairly well, but pylint reports
>> lots of false negatives and annoying details.)
>
> Why did you do this?  (just curious)
>
> I see that you rely on system wide imports now, a la
>
>  from ufl.algebra import something
>
> instead of from
>
>  from .algebra import something
>
> so there wont be any ambiguities w.r.t. to which packages is imported. Is it
> because you now can write
>
>  from ufl.algebra import *
>
> which you couldn't do with absolute import?

No, I don't want to use * inside ufl anyway, so it was a "good thing"
to be forced not to.

One of the reasons is that absolute_import is partially broken in 2.5, the files
using it cannot be executed (so you can't make small tests in a
__main__ clause).

But the main reason was that various tools haven't caught up with this yet.
For example pychecker and pylint (which are annoyingly slow to update it seems).
I've found static code analysis to be very useful for python, for finding bugs.
(Even better would be full code coverage in the unit tests though).

--
Martin


Follow ups

References