Skip to content
New issue

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

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

Already on GitHub? # to your account

Provide an abstract class hierarchy for the common interface #689

Open
ystradmann opened this issue Nov 24, 2020 · 2 comments
Open

Provide an abstract class hierarchy for the common interface #689

ystradmann opened this issue Nov 24, 2020 · 2 comments
Milestone

Comments

@ystradmann
Copy link

Hi,

for clarification of the types and methods a backend has to implement, it would be nice if pyNN's interface would be defined by python's Abstract Base Classes. The corresponding PEP 3119 constitutes the usage of ABCs (among others) as

In addition, the ABCs define a minimal set of methods that establish the characteristic behavior of the type. Code that discriminates objects based on their ABC type can trust that those methods will always be present.

– which describes the requirement of all pyNN backends to behave similarly very well.

I see several advantages from such an architecture:

  • When implementing a new backend, it's very clear what (minimally) needs to be implemented – without the need for looking at calling code
  • If a feature is not implemented in one of the backends, a descriptive error of the instantiated class being abstract will be thrown by the interpreter
  • The official pyNN-API would be well defined in-code and not rely on conventions (functionality that every backend implements)

I am aware that implementing this concept might require refactoring of substantial parts of the codebase. This issue should therefore be understood as a suggestion for a potential enhancement of pyNN; it's in no way to be seen as a bug report.

Best,
Yannik

@apdavison
Copy link
Member

Many thanks for creating this issue, @ystradmann. This is indeed one of the tasks we have planned before releasing PyNN 1.0, it is good to have an issue for it.

@ystradmann
Copy link
Author

That's awesome, thanks a lot for your great work!

@apdavison apdavison added this to the 1.0 milestone Dec 22, 2020
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

2 participants