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 John Hagen
Recipients John Hagen
Date 2016-12-06.13:43:37
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1481031817.69.0.735601842725.issue28886@psf.upfronthosting.co.za>
In-reply-to
Content
In the abc module (https://docs.python.org/3/library/abc.html) the following decorators have been deprecated since Python 3.3:

- abstractclassmethod
- abstractstaticmethod
- abstractproperty

But if you run the following example code using Python 3.5.2 with -Werror, no DeprecationWarnings are thrown. Throwing DeprecationWarnings will help make it more clear that these properties should not be used. PyCharm, for example, will strikethrough the usage of methods that throw DeprecationWarning so that even new users will be notified quickly even if they don't run with -Werror.


import abc


class Base(abc.ABC):
    @abc.abstractclassmethod
    def abstract_class(cls):
        pass

    @abc.abstractstaticmethod
    def abstract_static():
        pass

    @abc.abstractproperty
    def abstract_property(self):
        pass


class Child(Base):
    @classmethod
    def abstract_class(cls):
        print('Abstract class method')

    @staticmethod
    def abstract_static():
        print('Abstract static method')

    @property
    def abstract_property(self):
        return 'Abstract property'


child = Child()
child.abstract_class()
child.abstract_static()
print(child.abstract_property)
History
Date User Action Args
2016-12-06 13:43:37John Hagensetrecipients: + John Hagen
2016-12-06 13:43:37John Hagensetmessageid: <1481031817.69.0.735601842725.issue28886@psf.upfronthosting.co.za>
2016-12-06 13:43:37John Hagenlinkissue28886 messages
2016-12-06 13:43:37John Hagencreate