File tree Expand file tree Collapse file tree 3 files changed +15
-2
lines changed
doc/data/messages/d/dangerous-default-value Expand file tree Collapse file tree 3 files changed +15
-2
lines changed Original file line number Diff line number Diff line change
1
+ def whats_on_the_telly (penguin = []): # [dangerous-default-value]
2
+ penguin .append ("property of the zoo" )
3
+ return penguin
Original file line number Diff line number Diff line change 1
- You can help us make the doc better `by contributing <https://github.com/PyCQA/pylint/issues/5953 >`_ !
1
+ With a mutable default value, with each call the default value is modified, i.e.:
2
+
3
+ .. code-block :: python
4
+
5
+ whats_on_the_telly() # ["property of the zoo"]
6
+ whats_on_the_telly() # ["property of the zoo", "property of the zoo"]
7
+ whats_on_the_telly() # ["property of the zoo", "property of the zoo", "property of the zoo"]
Original file line number Diff line number Diff line change 1
- # This is a placeholder for correct code for this message.
1
+ def whats_on_the_telly (penguin = None ):
2
+ if penguin is None :
3
+ penguin = []
4
+ penguin .append ("property of the zoo" )
5
+ return penguin
You can’t perform that action at this time.
0 commit comments