@@ -91,8 +91,8 @@ user-defined type:
91
91
92
92
93
93
While this example works for serializing ``Person ``, we won't be able to
94
- serialize a :class: ` list ` of ``Person `` because the implementation of
95
- `` to_json `` for :class: ` list ` won't call ``to_json_person ``.
94
+ serialize a `` list `` of ``Person `` because the implementation of `` to_json ``
95
+ for `` list ` ` won't call ``to_json_person ``.
96
96
97
97
98
98
Type Classes
@@ -131,7 +131,7 @@ Tutorial
131
131
132
132
How can we replicate type classes in Python?
133
133
134
- Decorate a method signature with a call to :func: ` typeclass `, giving it the
134
+ Decorate a method signature with a call to `` typeclass ` `, giving it the
135
135
name of a type variable. The decorator will check the signature to make sure
136
136
that the type variable appears at least once in the type annotations of the
137
137
parameters. Unlike Haskell, Python cannot infer the *return type * at a call
@@ -146,12 +146,11 @@ site, so that path to instance discovery is impossible; the type variable
146
146
""" Serialize a value to JSON."""
147
147
148
148
We may optionally provide a default implementation. If we do not, the
149
- default behavior is to raise a :class: ` NotImplementedError ` diagnosing
149
+ default behavior is to raise a `` NotImplementedError ` ` diagnosing
150
150
a missing instance for the specific type variable.
151
151
152
- The :func: `typeclass ` decorator will add an :func: `instance ` attribute to the
153
- method. Use that to decorate monomorphic implementations, giving it the type
154
- argument:
152
+ The ``typeclass `` decorator will add an ``instance `` attribute to the method.
153
+ Use that to decorate monomorphic implementations, giving it the type argument:
155
154
156
155
.. code-block :: python
157
156
0 commit comments