I've been reading PEP 3119 and the documentation for ABCs in the
python documentation. According to the PEP, the following should yield
an error, because the abstract property has not been overridden:

import abc
class C:
    __metaclass__ = abc.ABCMeta
    @abc.abstractproperty
    def x(self):
        return 1
c=C()

but an error is not raised, nor for the case where I do:

class D(C):
    pass
d=D()

Have I misunderstood the documentation? Why doesn't this raise an
error? I see the same behavior with the @abstractmethod.

Also, why isn't it possible to declare an abstract read/write property
with the decorator syntax:

class C:
    __metaclass__ = abc.ABCMeta
    @abc.abstractproperty
    def x(self):
        pass
    @x.setter
    def x(self, val):
        "this is also abstract"

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to