You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When reading the document for Inheritance of Data-Oriented classes. I simply understand the data-oriented classes have the same behavior of inheritance as ordinary python classes.
However, I find the property method rewritten in the subclass cannot override the property method with the same name in the base class if the base class is decorated with @ti.data_oriented. A simple code can be used for test as below,
import taichi as ti
@ti.data_oriented
class BaseClass(object):
@property
def one_property(self):
return "Property of super-class"
@ti.kernel
def compute(self):
pass
@ti.func
def some_function(self):
pass
class DeviatedClass(BaseClass):
@property
def one_property(self):
return "Property of sub-class"
a = DeviatedClass()
print(a.one_property)
# output: Property of super-class
where I expect it to output "Property of sub-class". However, it gives the output of "Property of super-class".
I am wondering whether this is a bug or by design. If it is the latter, I think it is essential to explain it in more detail in the document. Since it is a different behavior with ordinary python classes, and may cause very hidden problems in some situations.
The text was updated successfully, but these errors were encountered:
When reading the document for Inheritance of Data-Oriented classes. I simply understand the data-oriented classes have the same behavior of inheritance as ordinary python classes.
However, I find the property method rewritten in the subclass cannot override the property method with the same name in the base class if the base class is decorated with
@ti.data_oriented
. A simple code can be used for test as below,where I expect it to output "Property of sub-class". However, it gives the output of "Property of super-class".
I am wondering whether this is a bug or by design. If it is the latter, I think it is essential to explain it in more detail in the document. Since it is a different behavior with ordinary python classes, and may cause very hidden problems in some situations.
The text was updated successfully, but these errors were encountered: