diff --git a/special-method-names.html b/special-method-names.html index 63adebd..0821d09 100644 --- a/special-method-names.html +++ b/special-method-names.html @@ -18,7 +18,7 @@
Throughout this book, you’ve seen examples of “special methods” — certain “magic” methods that Python invokes when you use certain syntax. Using special methods, your classes can act like sequences, like dictionaries, like functions, like iterators, or even like numbers. This appendix serves both as a reference for the special methods we’ve seen already and a brief introduction to some of the more esoteric ones. +
Throughout this book, you’ve seen examples of “special methods” — certain “magic” methods that Python invokes when you use certain syntax. Using special methods, your classes can act like sets, like dictionaries, like functions, like iterators, or even like numbers. This appendix serves both as a reference for the special methods we’ve seen already and a brief introduction to some of the more esoteric ones.
__call__() method 12 times, which updates its internal state and returns a resulting byte 12 times.
-If your class acts as a container for a set of values — that is, if it makes sense to ask whether your class “contains” a value — then it should probably define the following special methods that make it act like a sequence. +
If your class acts as a container for a set of values — that is, if it makes sense to ask whether your class “contains” a value — then it should probably define the following special methods that make it act like a set.
| Notes @@ -264,7 +264,7 @@ bytes = zef_file.read(12) | seq.__contains__(x)
|
|---|
The cgi module uses these methods in its FieldStorage class, which represents all of the form fields or query parameters submitted to a dynamic web page.
+
The cgi module uses these methods in its FieldStorage class, which represents all of the form fields or query parameters submitted to a dynamic web page.
# A script which responds to http://example.com/search?q=cgi
import cgi
@@ -319,7 +319,7 @@ class FieldStorage:
x.__missing__(nonexistent_key)
-The FieldStorage class from the cgi module also defines these special methods, which means you can do things like this:
+
The FieldStorage class from the cgi module also defines these special methods, which means you can do things like this:
# A script which responds to http://example.com/search?q=cgi
import cgi