-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Avoid shadowing important built-ins in the example code #2157
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
Conversation
Welcome @rafrafek! |
Please sign the CLA |
@roycaihw done! |
The Kubernetes project currently lacks enough contributors to adequately respond to all PRs. This bot triages PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
Bump. /remove-lifecycle stale |
The Kubernetes project currently lacks enough contributors to adequately respond to all PRs. This bot triages PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
Bump. /remove-lifecycle stale |
Is "cleanup" the best choice? /kind cleanup |
The Kubernetes project currently lacks enough contributors to adequately respond to all PRs. This bot triages PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
Still relevant /remove-lifecycle stale |
Hello @yliaog, could you take a look at this PR? I don't need to be the author, feel free to create a new PR with this change. The only reason I made this PR is because my friend copied the example code in the past and it broke his code because of shadowing the built-in |
thanks for the PR. /lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: rafrafek, yliaog The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
What type of PR is this? cleanup(?)
/kind cleanup
What this PR does / why we need it:
Fixes a lot of potential issues when someone tries to use the code from the example.
Changes in naming:
type
totype_
: The variabletype
is renamed totype_
. In Python, type is a built-in name for a function that returns the type of an object. Usingtype
as a variable name can shadow this built-in function, which could lead to confusion or errors in the code. Renaming it totype_
avoids this potential issue.object
toobject_
: Similarly,object
is a built-in type in Python (for instance,object
is the base class for all classes in Python). Usingobject
as a variable name can also overshadow the built-inobject
type, which can lead to bugs or misunderstandings. Renaming it toobject_
avoids this issue.Which issue(s) this PR fixes:
Special notes for your reviewer:
Does this PR introduce a user-facing change? NONE
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: