Dangerous default argument should include "Stateful" default arguments as well #4659
Labels
Enhancement ✨
Improvement to a component
Good first issue
Friendly and approachable by new contributors
Hacktoberfest
Help wanted 🙏
Outside help would be appreciated, good for new contributors
Needs PR
This issue is accepted, sufficiently specified and now needs an implementation
Is your feature request related to a problem? Please describe
A clear and concise description of what the problem is.
When a function is defined, a function will maintain the state of the default argument. This can be dangerous if the default argument is something like
datetime.date.today()
. In this article, it states that:Thus, if a production environment has a pod that evaluates a function once and the pod doesn't rotate for a couple days, it will continue to define that default argument incorrectly.
Describe the solution you'd like
It would be nice if
pylint
warns us about these dangerous default "stateful" arguments, similar to the warning about dangerous "mutable" default arguments, e.g. http://pylint-messages.wikidot.com/messages:w0102A clear and concise description of what you want to happen.
Additional context
Add any other context about the feature request here.
The text was updated successfully, but these errors were encountered: