On Thu, Dec 5, 2013 at 1:24 PM, Guido van Rossum <[email protected]> wrote:
> How would you get the docstrings in? It seems cramming that much on a
> single line doesn't help readability (even though I agree there is a
> fair amount of boilerplace).
>
One way to reduce the amount of boilerplate code is to make abstractmethod
to supply raise NotImplementedError body when none is given. Then you can
write
class Foo:
@abc.abstractmethod
def do_bar(self):
"""perform bar"""
instead of
class Foo:
@abc.abstractmethod
def do_bar(self):
"""perform bar"""
raise NotImplementedError
The docstring will be required when skipping the body which is probably a
good thing.
_______________________________________________
Python-Dev mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com