New submission from Matteo Dell'Amico <de...@linux.it>: 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/abc.py", 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() 42 ---------- components: Library (Lib) messages: 86744 nosy: della severity: normal status: open title: No way to create an abstract classmethod type: behavior versions: Python 3.0 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue5867> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com