Skip to content

Conversation

@Flamefire
Copy link
Contributor

hasattr is basically calling getattr and checking for AttributeError.
It also supports a default value in case the attribute is not found. Make use of that default value and catch the exception directly instead of checking hasattr where that makes sense.

`hasattr` is basically calling `getattr` and checking for
`AttributeError`.
It also supports a default value in case the attribute is not found.
Make use of that default value and catch the exception directly instead
of checking `hasattr` where that makes sense.
@jfgrimm jfgrimm added this to the 4.x milestone Dec 26, 2023
@boegel boegel changed the title Cleanup uses of getattr and hasattr clean up uses of getattr and hasattr Jan 3, 2024
Copy link
Member

@boegel boegel left a comment

Choose a reason for hiding this comment

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

lgtm

@boegel boegel modified the milestones: 4.x, release after 4.9.0 Jan 3, 2024
@boegel boegel merged commit 00a3f52 into easybuilders:develop Jan 3, 2024
@Flamefire Flamefire deleted the cleanup-attr branch January 3, 2024 08:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants