Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use inheritance instead of assignment for "attached" classes #161

Open
jpfeuffer opened this issue Aug 21, 2022 · 0 comments
Open

Use inheritance instead of assignment for "attached" classes #161

jpfeuffer opened this issue Aug 21, 2022 · 0 comments

Comments

@jpfeuffer
Copy link
Contributor

jpfeuffer commented Aug 21, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant