Skip to content

Efficiency: remove unnecessary copy operation#288

Open
MetRonnie wants to merge 1 commit into
metomi:masterfrom
MetRonnie:optimise
Open

Efficiency: remove unnecessary copy operation#288
MetRonnie wants to merge 1 commit into
metomi:masterfrom
MetRonnie:optimise

Conversation

@MetRonnie

Copy link
Copy Markdown
Contributor

Alternative to #285

@MetRonnie MetRonnie added this to the 3.2.0 milestone Jun 29, 2026
@MetRonnie
MetRonnie requested a review from oliver-sanders June 29, 2026 15:30
@MetRonnie MetRonnie self-assigned this Jun 29, 2026
for attr in self.__slots__:
value = getattr(self, attr, None)
if callable(getattr(value, "_copy", None)):
value = value._copy()

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am convinced this copy was unnecessary. Note it's the time zone that was being copied. The only uses of this method:

  • In the comparison function, where no references to the time zone are created
  • In def get_timepoint_properties_from_seconds_since_unix_epoch(), where a local reference to the time zone is created, but not mutated

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.

1 participant