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

Improving things for runtime and adding abstractmethod. #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Montana
Copy link

@Montana Montana commented Sep 18, 2024

Hi @PartTimeLegend, this is a synopsis of what I changed,

Added from abc import ABC and abstractmethod.

This imports the necessary tools from Python's Abstract Base Class (ABC) module.

Changed class RadioDetector to class RadioDetector(ABC).

Thus by inheriting from ABC, we explicitly declare this as an abstract base class.

This makes the intention clearer and provides better support for abstract methods.

Replaced raise NotImplementedError(...) with @abstractmethod decorator.

The @abstractmethod decorator is more idiomatic in Python for defining abstract methods. It prevents instantiation of any subclass that doesn't implement these methods, which is more robust than raising an error at runtime.

Cheers,
Michael Mendy.

Added from abc import ABC, `abstractmethod`.

This imports the necessary tools from Python's Abstract Base Class (ABC) module.

Changed class `RadioDetector` to class `RadioDetector(ABC)`.

Thus by inheriting from ABC, we explicitly declare this as an abstract base class. 

This makes the intention clearer and provides better support for abstract methods.

Replaced raise `NotImplementedError(...)` with `@abstractmethod` decorator.

The `@abstractmethod` decorator is more idiomatic in Python for defining abstract methods. It prevents instantiation of any subclass that doesn't implement these methods, which is more robust than raising an error at runtime.
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

Successfully merging this pull request may close these issues.

1 participant