I have a function which functionality can be described with this code:
class Test:
def __init__(self) -> None:
pass
def __str__(self) -> str:
return "testing"
@property
def first(self):
return Test()
test = Test()
print(test.first)
print(test.first.first)
(Output)
testing
testing
Basicly, it has a recursive property. I want to edit the property function of the class, but save the recursion: (This doesnt work but explains my idea)
def edit_property(test_class):
@test_class.property
def first(test_class):
return test_class.first + " test"
edit_property(test)
The result of this code would be (if it would work)
testing test
testing test test