← Back to team overview

dolfin team mailing list archive

Re: [Bug 793512] [NEW] Classes are indexed twice in Python Programmer's Reference

 

On 6 June 2011 20:09, Johan Hake <793512@xxxxxxxxxxxxxxxxxx> wrote:
> On Monday June 6 2011 10:58:57 Kristian B. Ølgaard wrote:
>> On 6 June 2011 17:35, Marie Rognes <793512@xxxxxxxxxxxxxxxxxx> wrote:
>> > On 06/06/2011 05:01 PM, Kristian B. Ølgaard wrote:
>> >> On 6 June 2011 15:03, Marie Rognes<793512@xxxxxxxxxxxxxxxxxx>  wrote:
>> >>> Public bug reported:
>> >>>
>> >>>
>> >>> Python classes are indexed (at least) twice in the Python Programmer's
>> >>> Reference, for instance the index points to the class FunctionSpace in
>> >>> both dolfin.functions and dolfin.functions.functionspace:
>> >>>
>> >>>   FunctionSpace (class in dolfin.cpp)
>> >>>
>> >>>       (class in dolfin.functions)
>> >>>       (class in dolfin.functions.functionspace)
>> >>>
>> >>> Is this intended? If so, it is confusing.
>> >>
>> >> Not all classes are indexed twice, e.g., the FiniteElement is only
>> >> defined in dolfin.cpp.
>> >> What part is it that you find confusing?
>> >
>> > Sorry, didn't mean to be unclear. The confusing part is probably (class
>> > in dolfin.functions)
>> >
>> >> The dolfin.cpp.FunctionSpace and
>> >> dolfin.functions.functionspace.FunctionSpace are two
>> >> different classes so there should be two entries.
>> >
>> > Agree.
>> >
>> >> The FunctionSpace class from dolfin.functions is picked up because
>> >> FunctionSpace is included in the __all__ variable
>> >> in dolfin.functions.__init__.py.
>> >> So perhaps we could skip extracting functions and classes from
>> >> __init__.py files, and just hope that no one actually defines a class
>> >> or a function in these files?
>> >
>> > I think this (skipping extracting functions and classes from
>> > __init__.py) sounds like a sane assumption.
>>
>> Otherwise, we will have to remove the __all__ variable in
>> dolfin/functions/__init__.py,
>
> I added the __all__ variable a couple of week ago for a reason. Unfortuntely I
> cannot recal right now why :P, but I think it was something Martin detected.
> So I would suggest keeping __all__ in these modules.

OK, I've pushed a fix to do what your note in __init__.py says.

Kristian

> Johan
>
>> but then we can't import FunctionSpace by:
>>
>> from dolfin.functions import *
>>
>> and in dolfin/__init__.py we have to import:
>>
>> from dolfin.functions.functionspace import *
>>
>> to get FunctionSpace included.
>>
>> But I think ignoring __all__ in __init__.py's is better.
>>
>> Kristian
>>
>> > --
>> > Marie
>> >
>> >> Kristian
>> >>
>> >>> ** Affects: dolfin
>> >>>      Importance: Undecided
>> >>>          Status: New
>> >>>
>> >>> --
>> >>> You received this bug notification because you are a member of DOLFIN
>> >>> Core Team, which is subscribed to DOLFIN.
>> >>> https://bugs.launchpad.net/bugs/793512
>> >>>
>> >>> Title:
>> >>>   Classes are indexed twice in Python Programmer's Reference
>> >>>
>> >>> Status in DOLFIN:
>> >>>   New
>> >>>
>> >>> Bug description:
>> >>>
>> >>>   Python classes are indexed (at least) twice in the Python
>> >>> Programmer's Reference, for instance the index points to the class
>> >>> FunctionSpace in both dolfin.functions and
>> >>> dolfin.functions.functionspace:
>> >>>
>> >>>     FunctionSpace (class in dolfin.cpp)
>> >>>
>> >>>         (class in dolfin.functions)
>> >>>         (class in dolfin.functions.functionspace)
>> >>>
>> >>>   Is this intended? If so, it is confusing.
>> >
>> > --
>> > You received this bug notification because you are a member of DOLFIN
>> > Core Team, which is subscribed to DOLFIN.
>> > https://bugs.launchpad.net/bugs/793512
>> >
>> > Title:
>> >  Classes are indexed twice in Python Programmer's Reference
>> >
>> > Status in DOLFIN:
>> >  New
>> >
>> > Bug description:
>> >
>> >  Python classes are indexed (at least) twice in the Python Programmer's
>> > Reference, for instance the index points to the class FunctionSpace in
>> > both dolfin.functions and dolfin.functions.functionspace:
>> >
>> >    FunctionSpace (class in dolfin.cpp)
>> >
>> >        (class in dolfin.functions)
>> >        (class in dolfin.functions.functionspace)
>> >
>> >  Is this intended? If so, it is confusing.
>
> --
> You received this bug notification because you are a member of DOLFIN
> Core Team, which is subscribed to DOLFIN.
> https://bugs.launchpad.net/bugs/793512
>
> Title:
>  Classes are indexed twice in Python Programmer's Reference
>
> Status in DOLFIN:
>  New
>
> Bug description:
>
>  Python classes are indexed (at least) twice in the Python Programmer's Reference, for instance the index points to the class FunctionSpace in both dolfin.functions and dolfin.functions.functionspace:
>
>    FunctionSpace (class in dolfin.cpp)
>
>        (class in dolfin.functions)
>        (class in dolfin.functions.functionspace)
>
>  Is this intended? If so, it is confusing.
>


** Changed in: dolfin
       Status: New => Fix Committed

-- 
You received this bug notification because you are a member of DOLFIN
Team, which is subscribed to DOLFIN.
https://bugs.launchpad.net/bugs/793512

Title:
  Classes are indexed twice in Python Programmer's Reference

Status in DOLFIN:
  Fix Committed

Bug description:
  
  Python classes are indexed (at least) twice in the Python Programmer's Reference, for instance the index points to the class FunctionSpace in both dolfin.functions and dolfin.functions.functionspace:

    FunctionSpace (class in dolfin.cpp)

        (class in dolfin.functions)
        (class in dolfin.functions.functionspace) 

  Is this intended? If so, it is confusing.


Follow ups

References