[Python-Dev] One-line abstractmethod function?
Allen Li
cyberdupo56 at gmail.com
Mon Dec 9 20:52:53 CET 2013
More information about the Python-Dev mailing list
Mon Dec 9 20:52:53 CET 2013
- Previous message: [Python-Dev] Attribute docstrings [was: One-line abstractmethod function?]
- Next message: [Python-Dev] One-line abstractmethod function?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
I just wanted to sum up this thread of discussion.
Proposal:
A function in abc to provide a default abstract method
implementation.
foo = make_abstractmethod('foo', ['self'])
is the same as
@abc.abstractmethod
def foo(self):
pass
Details:
Default behavior, if implemented, should probably be empty/pass/return
None. How to handle docstrings? Either attribute docstring (a separate
discussion) or a parameter in the function call.
Pros:
Save a lot of lines defining interface-like ABCs, especially in small
scripts without docstrings (bad practice, but I do it often =))
Cons:
Do we need it?
- Previous message: [Python-Dev] Attribute docstrings [was: One-line abstractmethod function?]
- Next message: [Python-Dev] One-line abstractmethod function?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-Dev mailing list