Re: ABC with abstractmethod: kwargs on Base, explicit names on implementation

2020-08-29 Thread Samuel Marks
Putting Liskov substitution principal to one side, I had a suggestion to follow PEP3102, and do `def train(self, *, epochs):`… It's a rather simple suggestion that I just might take aboard. In response to Dieter: My purpose for using a base class is so that the highest level interface—say a CLI,

Re: ABC with abstractmethod: kwargs on Base, explicit names on implementation

2020-08-29 Thread Dieter Maurer
Samuel Marks wrote at 2020-8-29 19:14 +1000: >So there is no way to get a AOT error when the two functions aren't >implemented, if the two functions have different required arguments on >implementors? > >To paint this picture for why I need this, say the first is: > >class Base(ABC): >@abstract

Re: ABC with abstractmethod: kwargs on Base, explicit names on implementation

2020-08-29 Thread Samuel Marks
So there is no way to get a AOT error when the two functions aren't implemented, if the two functions have different required arguments on implementors? To paint this picture for why I need this, say the first is: class Base(ABC): @abstractclass def train(self, epochs): asset epoc

Re: ABC with abstractmethod: kwargs on Base, explicit names on implementation

2020-08-27 Thread Dieter Maurer
Samuel Marks wrote at 2020-8-27 15:58 +1000: >The main thing I want is type safety. I want Python to complain if the >callee uses the wrong argument types, and to provide suggestions on >what's needed and info about it. > >Without a base class I can just have docstrings and type annotations >to ach

Re: ABC with abstractmethod: kwargs on Base, explicit names on implementation

2020-08-27 Thread Peter Otten
Samuel Marks wrote: > The main thing I want is type safety. I want Python to complain if the > callee uses the wrong argument types, and to provide suggestions on > what's needed and info about it. > > Without a base class I can just have docstrings and type annotations > to achieve that. > > Wh

Re: ABC with abstractmethod: kwargs on Base, explicit names on implementation

2020-08-26 Thread Samuel Marks
The main thing I want is type safety. I want Python to complain if the callee uses the wrong argument types, and to provide suggestions on what's needed and info about it. Without a base class I can just have docstrings and type annotations to achieve that. What can I use that will require all im

Re: ABC with abstractmethod: kwargs on Base, explicit names on implementation

2020-08-25 Thread Dieter Maurer
Samuel Marks wrote at 2020-8-24 18:24 +1000: >After a discussion on #python on Freenode, I'm here. > >The gist of it is: >> Falc - Signature of method 'Pharm.foo()' does not match signature of base >> method in class 'Base' > >What's the right way of specialising the children and leaving the Base

ABC with abstractmethod: kwargs on Base, explicit names on implementation

2020-08-24 Thread Samuel Marks
After a discussion on #python on Freenode, I'm here. The gist of it is: > Falc - Signature of method 'Pharm.foo()' does not match signature of base > method in class 'Base' What's the right way of specialising the children and leaving the Base pretty much empty? Specifically I want: • All imple