[Python-Dev] One-line abstractmethod function?

Alexander Belopolsky alexander.belopolsky at gmail.com
Thu Dec 5 22:19:26 CET 2013


On Thu, Dec 5, 2013 at 3:06 PM, Brett Cannon <brett at python.org> wrote:

> How will abstractmethod know its function has no body?
>>
>
> Technically you could inspect the code object of the method. to figure out
> if the body is empty.
>

One way if to check f.__code__.co_lnotab - it will be empty when f has no
body.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20131205/6628ee65/attachment.html>


More information about the Python-Dev mailing list