New submission from 猫 黒 <cyberdup...@gmail.com>: super() objects allow access to inherited properties fget() but not fset() or fdel(), resulting in unexpected behavior.
Today on pydev thread 'Property inheritance in Python' GvR said "I don't see the need for a Python-Ideas detour. It seems worth fixing" >>> class BaseProp(object): ... @property ... def p(self): ... return self._p ... @p.setter ... def p(self, value): ... self._p = value >>> class DerivedProp(BaseProp): ... @property ... def p(self): ... return super(DerivedProp, self).p * 2 ... @p.setter ... def p(self, value): ... super(DerivedProp, self).p = value / 2 >>> d = DerivedProp() >>> d._p = 21 >>> d.p 42 >>> d.p = 50 Traceback (most recent call last): ... AttributeError: 'super' object has no attribute 'p' ---------- components: Library (Lib) messages: 161980 nosy: 猫.黒 priority: normal severity: normal status: open title: super() and property inheritance behavior type: behavior versions: Python 3.2 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue14965> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com