Skip to content

Conversation

timbauman
Copy link
Contributor

@timbauman timbauman commented Sep 5, 2025

Do in-place updates of the Project object for more predictable behavior

@timbauman timbauman requested review from jonopray and jldinh September 5, 2025 23:42
@timbauman timbauman marked this pull request as draft September 5, 2025 23:50
@timbauman timbauman marked this pull request as ready for review September 9, 2025 05:10
@jldinh
Copy link
Contributor

jldinh commented Sep 9, 2025

What is the issue we are trying to address here?
Is it for comparing pre and post-update objects?


# If the Project has Questions, convert each into a Question object
if hasattr(self, "questions"):
self.questions = self._convert_questions_to_objects(self.questions)
Copy link
Contributor

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.

Copy link
Contributor Author

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

@timbauman
Copy link
Contributor Author

timbauman commented Sep 9, 2025

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants