1
0
mirror of https://github.com/adambard/learnxinyminutes-docs.git synced 2025-08-13 02:04:23 +02:00

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

View File

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