New question #97842 on DOLFIN:
https://answers.launchpad.net/dolfin/+question/97842

Is there a less hacked way to add extra parameter values to be used in an 
Expression in python than:

class MyExp(Expression):
    def __new__(cls, *args, **kwargs):
        obj = Expression.__new__(cls, **kwargs)
        return obj

    def __init__(self, *args):
        ....
        ....

where *args are my extra parameters (ie mesh, mesh functions etc.) and __new__ 
might have to be better worked if I had included my own kwargs. The above seems 
to work ok, but let me know of any major problems with it.

I could always use a MyExp.init(...) function after I've created an instance to 
set up class variables, but just curious as to whether I missed something 
obvious for a one line initiation.

David.

-- 
You received this question notification because you are a member of
DOLFIN Team, which is an answer contact for DOLFIN.

_______________________________________________
Mailing list: https://launchpad.net/~dolfin
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~dolfin
More help   : https://help.launchpad.net/ListHelp

Reply via email to