Class attribute inheritance deviation
Open
type-bug
- Dominant language
- Python
- Stars
- 521
- Forks
- 86
- Avg merge
- 1d 13h
- Merged PRs (30d)
- 35
Description
In a hierarchy of classes having class attributes, updating the class attribute in a super class is seen by the subclasses. Below `B.p` resolves to the updated value of `p` on `A`.
```python
class A:
p = 1
class B(A):
pass
print(B.p)
# 1
A.p = 2
print(B.p)
# 2
```
This is not how Param behaves, updating `p` on `A` has no effect on the subclasses. Not sure to which extent this is a bug.
```python
import param
class A(param.Parameterized):
p = param.Parameter(1)
class B(A):
p = param.Parameter()
print(B.p)
# 1
A.p = 2
print(B.p)
# (Different behavior)
# 1
```
Contributor guide
Assessment
This issue has not been assessed yet.