My IDE has "corrected" my code to convert a function (and other code) to a property. I am worried that it might be inefficient.
@property
def output_all_children(self):
lh = ListHolder()
traverse_directories(self.start_directory, lh)
return lh.internal_list
this does some heavy I/O lifting and takes some time. I am wondering now if this is incorrect due to efficiency reasons. I am wondering if the results aren't cached like I hoping would happen.
If this property is accessed several times is it going to rebuild and return the lh.internal_list every time? I would correct this by having a class level variable and updating it when self.start_directory is changed.
I have looked at this: How to create decorator for lazy initialization of a property and it refers to a read-only property while mine would be a updated property
Please no comments on trusting IDEs blindly. I know and that thinking prompted this question.