← Back to team overview

dolfin team mailing list archive

Function metaclass

 

Is it possible to break up the __new__ method for the metaclass
FunctionCreator in function.py?

I'm having a hard time following the logic. Would it be possible to
have some if-statements at the top that find out what needs to happen
and then call other methods that handle the work?

Something like this:

def __new__(cls, name, bases, dict_):

    if ...:
        return __new_discrete_function(...)
    elif ...:
        return __new_simple_jit_function(...)
    elif ...:
        return __new_complex_jit_function(...)
    elif ...:
        return __new_batch_jit_function(...)
    elif ...:
        return __new_python_subclass_function(...)
    elif ...:
        return __new_jit_subclass_function(...)
    else:
        dolfin.error("...")

The cases would correspond to the different ways a Function may be
initialized.

-- 
Anders

Attachment: signature.asc
Description: Digital signature