This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: abstractmethod can run on classes
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.6
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: Michael Hooreman, nikvanderhoof
Priority: normal Keywords:

Created on 2018-08-05 16:29 by Michael Hooreman, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (3)
msg323157 - (view) Author: Michael Hooreman (Michael Hooreman) Date: 2018-08-05 16:29
Hello,

When I decorate a class method with abc.abstractmethod, and I call it from the class (not the instance), the call is successful.

It looks like ID 5867 which was closed years ago.

See https://stackoverflow.com/questions/51669362/python-3-6-abc-abstracmethod-on-classmethod-no-check-on-class-level-call

Thanks!
msg323255 - (view) Author: Nikolas Vanderhoof (nikvanderhoof) Date: 2018-08-08 00:29
This behavior is consistent with the behavior described in the documentation for `@classmethod`.

https://docs.python.org/3.6/library/functions.html?highlight=classmethod#classmethod

"It can be called either on the class (such as C.f()) or on an instance (such as C().f())."

In this case, it can't be called on an instance because it is abstract, but since it's a classmethod, it is still okay to call it on the class directly.
msg323256 - (view) Author: Nikolas Vanderhoof (nikvanderhoof) Date: 2018-08-08 00:32
I've also posted that response on stackoverflow to your question in case others have the same confusion.
History
Date User Action Args
2022-04-11 14:59:04adminsetgithub: 78519
2021-12-06 13:55:09iritkatrielsetstatus: open -> closed
resolution: not a bug
stage: resolved
2018-08-08 00:32:28nikvanderhoofsetmessages: + msg323256
2018-08-08 00:29:59nikvanderhoofsetnosy: + nikvanderhoof
messages: + msg323255
2018-08-05 16:29:46Michael Hooremancreate