autowrap icon indicating copy to clipboard operation
autowrap copied to clipboard

Use inheritance instead of assignment for "attached" classes

Open jpfeuffer opened this issue 1 year ago • 0 comments

Instead of:

class Outer:
   Inner = _Inner

class _Inner:
   ...

We could do

class Outer:
   class Inner(_Inner): pass

class _Inner
  ...

This would help generate documentation with sphinx autodoc—otherwise the documentation of Outer.Inner is "alias of _Inner", which is kind of useless. Maybe there is another way with autodoc but this would be a quick fix. Not sure about runtime penalties though.

Ideally, we would have the full definition inside Outer but I think Cython does not really support that yet.

jpfeuffer avatar Aug 21 '22 17:08 jpfeuffer