generated from fastai/nbdev_template
-
Notifications
You must be signed in to change notification settings - Fork 289
Open
Description
Hi! Thanks for this wonderful library. Reporting a scenario where store_attr does not behave the way I want it to:
# case 1: works
class T:
def __init__(self, a, b, c):
store_attr()
def __repr__(self):
return f'T({self.__stored_args__})'
# case 2: fails
class T_:
def __init__(self, a, b, c):
self.a = a - 1 # modify variable a
store_attr()
def __repr__(self):
return f'T({self.__stored_args__})'
T(1, 2, 3), T_(1, 2, 3)
# (T({'a': 1, 'b': 2, 'c': 3}), T_({'a': 1, 'b': 2, 'c': 3}))In the second case, I would've expected T_.a to store the updated attribute, but this is not the case. Is this not the intended use case (to store all attributes) or is it supposed to be used only to store the args passed to instantiate the class?
Cheers,
Metadata
Metadata
Assignees
Labels
No labels