[python] multiple subclassing of Expression class

Issue #380 wontfix
Thomas Hisch created an issue

Due to a bug (or was this done on purpose?) in the Expression Metaclass it is not possible to define a subclass of a subclass of Expression.

Here is a MWE:

from dolfin import *


class A(Expression):
    def eval_cell(self, values, x, ufc_cell):
        pass


class B(A):
    def eval_cell(self, values, x, ufc_cell):
        pass
Traceback (most recent call last):
  File "mwe.py", line 9, in <module>
    class B(A):
  File "/usr/lib/python2.7/dist-packages/dolfin/functions/expression.py", line 298, in __new__
    user_bases.remove(Expression)
ValueError: list.remove(x): x not in list

Comments (4)

  1. Martin Sandve Alnæs

    Unless you have an elegant solution that doesn't increase the complexity, this is a wont-fix. Python has plenty of ways to share code between classes without subclassing so it's not hard to work around.

  2. Log in to comment