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.

Author della
Recipients della
Date 2009-04-28.14:24:10
SpamBayes Score 7.0531e-09
Marked as misclassified No
Message-id <>
Is there a way to define an abstract classmethod? The two obvious ways
don't seem to work properly.

Python 3.0.1+ (r301:69556, Apr 15 2009, 17:25:52) 
[GCC 4.3.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import abc
>>> class C(metaclass=abc.ABCMeta):
...     @abc.abstractmethod
...     @classmethod
...     def f(cls): print(42)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<stdin>", line 3, in C
  File "/usr/lib/python3.0/", line 24, in abstractmethod
    funcobj.__isabstractmethod__ = True
AttributeError: 'classmethod' object has no attribute '__isabstractmethod__'
>>> class C(metaclass=abc.ABCMeta):
...     @classmethod
...     @abc.abstractmethod
...     def f(cls): print(42)
>>> class D(C): pass
>>> D.f()
Date User Action Args
2009-04-28 14:24:12dellasetrecipients: + della
2009-04-28 14:24:12dellasetmessageid: <>
2009-04-28 14:24:11dellalinkissue5867 messages
2009-04-28 14:24:10dellacreate