refactor(PythonExecutor): inherit from ABC and declare abstract methods by HairlessVillager · Pull Request #1654 · huggingface/smolagents (original) (raw)
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice update declaring PythonExecutor as an ABC!
That said, for its methods, instead of manually raising NotImplementedError, you could use the @abstractmethod decorator from the abc module. It's specifically designed for this purpose and makes the intent clearer, while also ensuring subclasses must implement those methods.
Using @abstractmethod also removes the need for boilerplate error-raising code, keeping the interface clean and idiomatic.