-
Notifications
You must be signed in to change notification settings - Fork 2
Use cls for update #146
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Use cls for update #146
Conversation
What is the issue we are trying to address here? |
|
||
# If the Project has Questions, convert each into a Question object | ||
if hasattr(self, "questions"): | ||
self.questions = self._convert_questions_to_objects(self.questions) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The project is mutated in-place but the questions are re-instantiated. Is that desirable?
It seems inconsistent.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Definitely not desirable, but it seems relatively difficult to update questions in-place so I'd like to punt on that - see https://github.com/surge-ai/surge-python/blob/main/surge/questions.py#L41
@jldinh I think the current behavior is confusing, and ran into this issue when developing on top of it. I think there's rarely a need for maintaining a copy of the old state of the data when you update it |
Do in-place updates of the Project object for more predictable behavior