@@ -43,8 +43,8 @@ Outline
43
43
must not be overridden. Instead, the actual implementation should be in
44
44
*single underscore * methods, such as ``_add_ `` or ``_mul_ ``.
45
45
46
- Exceptions are ``__lshift__ ``, ``__rshift__ ``, ``__invert__ ``,
47
- where no default implementation is provided.
46
+ Exceptions are ``__lshift__ ``, ``__rshift__ ``, ``__and__ ``, `` __or__ ``,
47
+ `` __xor__ ``, `` __invert__ ``, where no default implementation is provided.
48
48
49
49
Also note that if the class is implemented in Cython, currently
50
50
SageMath uses a legacy behavior with ``c_api_binop_methods=True ``,
@@ -162,7 +162,7 @@ be complemented later.
162
162
....: def characteristic(self):
163
163
....: return self.base().characteristic()
164
164
165
- .. end ouf output
165
+ .. end of output
166
166
167
167
This basic implementation is formed by the following steps:
168
168
@@ -189,6 +189,9 @@ This basic implementation is formed by the following steps:
189
189
and it is requested to **implement SINGLE underscore methods ``_repr_``, and
190
190
similarly ``_add_``, ``_mul_`` etc. **
191
191
192
+ The double underscore methods that can be implemented by subclasses are
193
+ listed above.
194
+
192
195
- You are encouraged to **make your parent "unique" **. That's to say, parents
193
196
should only evaluate equal if they are identical. Sage provides frameworks
194
197
to create unique parents. We use here the most easy one: Inheriting from the
@@ -273,6 +276,13 @@ considerations:
273
276
etc. **We do not override the default double underscore ``__add__``, ``__mul__`` **,
274
277
since otherwise, we could not use Sage's coercion model.
275
278
279
+ The double underscore methods that can be implemented by subclasses are
280
+ listed above.
281
+
282
+ Note that the double-underscore method ``__neg__ `` just directly call the
283
+ single-underscore method ``_neg_ ``, the operation is unary so the coercion model
284
+ is unnecessary.
285
+
276
286
- Comparisons can be implemented using ``_richcmp_ ``.
277
287
This automatically makes the relational operators like
278
288
``== `` and ``< `` work. Inside this method, you can use
0 commit comments