From b02b14a3abb15f9183c7f2977f3e81147d8cbf9e Mon Sep 17 00:00:00 2001 From: Mark Pilgrim Date: Wed, 7 Oct 2009 10:15:03 -0400 Subject: [PATCH] markup fiddling --- special-method-names.html | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/special-method-names.html b/special-method-names.html index 4359bd0..86cc156 100644 --- a/special-method-names.html +++ b/special-method-names.html @@ -34,14 +34,14 @@ h3:before{counter-increment:h3;content:'B.' counter(h2) '.' counter(h3) '. '} ① to initialize an instance x = MyClass() -x.__init__() +x.__init__() ② the “official” representation as a string repr(x) -x.__repr__() +x.__repr__() ③ the “informal” value as a string -str(x) +str(x) x.__str__() ④ the “informal” value as a byte array @@ -49,8 +49,8 @@ h3:before{counter-increment:h3;content:'B.' counter(h2) '.' counter(h3) '. '} x.__bytes__() ⑤ the value as a formatted string -format(x, format_spec) -x.__format__(format_spec) +format(x, format_spec) +x.__format__(format_spec)
  1. The __init__() method is called after the instance is created. If you want to control the actual creation process, use the __new__() method.