Skip to content
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

removed a pitfall where a class field was being defined outside the init #493

Merged
merged 1 commit into from
Apr 4, 2022

Conversation

NaelsonDouglas
Copy link
Contributor

The problem
There was a class field being defined outside the class __init__
It might be problematic in some scenarios where the code tries to access the field before it is created. It also could hinder the understanding of the code due to the fact the class field definitions are scattered on the source instead of centralized into a single place.

This pitfall was detected automatically via Pylint, which triggered the warning code W0201 which is described here

The solution
Refactored the code to create the field on the __init__

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
Copy link
Collaborator

@SijmenHuizenga SijmenHuizenga left a comment

Choose a reason for hiding this comment

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

Sure looks good, thanks

@SijmenHuizenga SijmenHuizenga merged commit ed7d219 into dbader:master Apr 4, 2022
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.

None yet

2 participants