dolfin team mailing list archive
-
dolfin team
-
Mailing list archive
-
Message #10895
Re: Strange error from function.py
On Wednesday 03 December 2008 13:01:33 Martin Sandve Alnæs wrote:
> 2008/12/3 Anders Logg <logg@xxxxxxxxx>:
> > On Wed, Dec 03, 2008 at 12:24:38PM +0100, Martin Sandve Alnæs wrote:
> >> 2008/12/3 Anders Logg <logg@xxxxxxxxx>:
> >> > Another thing I've been wondering about is the renaming of
> >> > dolfin::Function to dolfin.cpp_Function. Is this really necessary?
> >> >
> >> > If we just removed the renaming, I guess it would still work out. So
> >> > we would create classes in function.py that inherit from ffc.Function
> >> > and dolfin.Function (instead of dolfin.cpp_Function).
> >>
> >> How?
> >
> > By just writing dolfin.Function instead of dolfin.cpp_Function in
> > function.py.
> >
> > In function.py, we import the SWIG-generated module "dolfin":
> >
> > import dolfin;
> >
> > This module may then contain a class named "Function" which is the
> > SWIG-generated wrapper for dolfin::Function (currently named
> > cpp_Function). We may then define a class named "Function" in the
> > function.py module, and this is the class that we import in the
> > top-level __init__.py (not the one from dolfin.dolfin).
> >
> > Does it make sense?
>
> So you mean
>
> dolfin.dolfin.Function == dolfin.cpp_Function
> dolfin.Function is a subclass of dolfin.dolfin.Function
>
> ?
>
> How does this make anything clearer?
> It only obfuscates what's being done,
> creates another namespace issue, and
> makes it even more difficult to talk about
> functions in dolfin.
I have actually been thinking in the same lanes as Anders. But keeping a
distinction to the compiled dolfin module in the module name instead as
cpp_dolfin.
from dolfin import *
Then the compiled version of some classes would be:
cpp_dolfin.Function aso.
But I see that we can introduce namespace troubles if some one accidentally
imports from cpp_dolfin.
Johan
Follow ups
References