summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGeoff Liu <cangming.liu@gmail.com>2015-03-24 12:44:03 -0600
committerGeoff Liu <cangming.liu@gmail.com>2015-03-24 12:44:03 -0600
commit4aa2eb3d297098041b927e9041e5005758da706c (patch)
treea1d76c0b7a2bac64b0b890dbc3138ae6f307cc27
parent928afcc4c735c64682b07a52d20baf437cef1316 (diff)
parent44c37d5531d42a73b0bde49525e586b413489caf (diff)
Merge pull request #1016 from nero-luci/patch-3
[python3.html.mardown] Added a short statement about magic methods
-rw-r--r--python3.html.markdown4
1 files changed, 3 insertions, 1 deletions
diff --git a/python3.html.markdown b/python3.html.markdown
index e8913267..56126ad3 100644
--- a/python3.html.markdown
+++ b/python3.html.markdown
@@ -498,7 +498,9 @@ class Human(object):
# Basic initializer, this is called when this class is instantiated.
# Note that the double leading and trailing underscores denote objects
# or attributes that are used by python but that live in user-controlled
- # namespaces. You should not invent such names on your own.
+ # namespaces. Methods(or objects or attributes) like: __init__, __str__,
+ # __repr__ etc. are called magic methods (or sometimes called dunder methods)
+ # You should not invent such names on your own.
def __init__(self, name):
# Assign the argument to the instance's name attribute
self.name = name