Merge pull request #3424 from EvilKhaosKat/patch-1

[python3/en] A note about common gotcha with mutable defaults
This commit is contained in:
Divay Prakash 2018-12-21 00:13:42 +05:30 committed by GitHub
commit f03d941d86
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -808,6 +808,7 @@ class Superhero(Human):
# add additional class attributes: # add additional class attributes:
self.fictional = True self.fictional = True
self.movie = movie self.movie = movie
# be aware of mutable default values, since defaults are shared
self.superpowers = superpowers self.superpowers = superpowers
# The "super" function lets you access the parent class's methods # The "super" function lets you access the parent class's methods