Skip to content

Conversation

Reskov
Copy link

@Reskov Reskov commented Mar 24, 2025

  • use .get instead of in and [] preventing extra dictionary lookup
  • use f-strings (since we support only 3.8+) reduce string concatenation overhead
  • use walrus operator (3.8+) remove extra getattr access in case raw_field found

- use .get
- use f-strings (since we support only 3.8+)
- use walrus operator (3.8+)
@alexanderjordanbaker
Copy link
Collaborator

@Reskov Are there any performance or other reasons for performing this change besides style?

@Reskov
Copy link
Author

Reskov commented Jul 8, 2025

This is more about style, rather the performance. For example, in +[] will get one extra dictionary lookup, so as general rule it is better to use get in such case. The same true about getattr, or f-string. But the impact of this is very low, so I am not sure that we will notice this in practice.

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