Can't get property value of the superclass
As following code shows, a subclass to override property 'p' of superclass. Calling super().p in subclass will return a property object, not the value. Further more, this property object has no .fget attribute as suggested in standard python. But a 'getter' method is found on property object, when I call .getter(o), another property object returned, still not value.
So, I can't get the property value of superclass. Any suggestion?
class A:
@property
def p(self):
return {"a":10}
class AA(A):
@property
def p(self):
# get super property, add some new value
v = super().p
v['aa'] = 20 # this will raise an exception, because v is a property object, not a dict
return v
super() does not support properties
Port, board and/or hardware
any
MicroPython version
current master
Reproduction
class A:
@property
def name(self):
return "Foo"
class B(A):
@property
def name(self):
return super().name+"Bar"
print(B().name)
Expected behaviour
MicroPython: "FooBar"
Observed behaviour
Python: "FooBar"
MicroPython: TypeError: unsupported types for __add__: 'property', 'str'
Additional Information
No, I've provided everything above.
Code of Conduct
Yes, I agree