From a81b2753138c5f1fda5630e1258a9e85394e55cb Mon Sep 17 00:00:00 2001
From: Paul McCarthy <pauldmccarthy@gmail.com>
Date: Thu, 15 Feb 2018 15:58:33 +0000
Subject: [PATCH] little tweaks to op-overload prac

---
 advanced_topics/04_operator_overloading.ipynb | 14 +++++++++-----
 advanced_topics/04_operator_overloading.md    | 14 +++++++++-----
 2 files changed, 18 insertions(+), 10 deletions(-)

diff --git a/advanced_topics/04_operator_overloading.ipynb b/advanced_topics/04_operator_overloading.ipynb
index 1b9ab7f..567fd7e 100644
--- a/advanced_topics/04_operator_overloading.ipynb
+++ b/advanced_topics/04_operator_overloading.ipynb
@@ -238,10 +238,14 @@
     "- Exclusive or (`^`): `__xor__`\n",
     "\n",
     "\n",
-    "Take a look at the [official\n",
+    "When an operator is applied to operands of different types, a set of fall-back\n",
+    "rules are followed depending on the set of methods implemented on the\n",
+    "operands. For example, in the expression `a + b`, if `a.__add__` is not\n",
+    "implemented, but but `b.__radd__` is implemented, then the latter will be\n",
+    "called.  Take a look at the [official\n",
     "documentation](https://docs.python.org/3.5/reference/datamodel.html#emulating-numeric-types)\n",
-    "for a full list of the arithmetic and logical operators that your classes can\n",
-    "support.\n",
+    "for further details, including a full list of the arithmetic and logical\n",
+    "operators that your classes can support.\n",
     "\n",
     "\n",
     "<a class=\"anchor\" id=\"equality-and-comparison-operators\"></a>\n",
@@ -332,7 +336,7 @@
     "l3 = Label(3, 'Temporal',  (  0,   0, 255))\n",
     "\n",
     "print('{} >  {}: {}'.format(l1, l2, l1  > l2))\n",
-    "print('{} <  {}: {}'.format(l1, l3, l1  < l3))\n",
+    "print('{} <  {}: {}'.format(l1, l3, l1 <= l3))\n",
     "print('{} != {}: {}'.format(l2, l3, l2 != l3))\n",
     "print(sorted((l3, l1, l2)))"
    ]
@@ -715,7 +719,7 @@
     "\n",
     "print('v:   ', v)\n",
     "print('xyz: ', v.xyz)\n",
-    "print('yz:  ', v.zy)\n",
+    "print('zy:  ', v.zy)\n",
     "print('xx:  ', v.xx)\n",
     "\n",
     "v.xz = 10, 30\n",
diff --git a/advanced_topics/04_operator_overloading.md b/advanced_topics/04_operator_overloading.md
index 142368f..3446401 100644
--- a/advanced_topics/04_operator_overloading.md
+++ b/advanced_topics/04_operator_overloading.md
@@ -168,10 +168,14 @@ appropriate method, for example:
 - Exclusive or (`^`): `__xor__`
 
 
-Take a look at the [official
+When an operator is applied to operands of different types, a set of fall-back
+rules are followed depending on the set of methods implemented on the
+operands. For example, in the expression `a + b`, if `a.__add__` is not
+implemented, but but `b.__radd__` is implemented, then the latter will be
+called.  Take a look at the [official
 documentation](https://docs.python.org/3.5/reference/datamodel.html#emulating-numeric-types)
-for a full list of the arithmetic and logical operators that your classes can
-support.
+for further details, including a full list of the arithmetic and logical
+operators that your classes can support.
 
 
 <a class="anchor" id="equality-and-comparison-operators"></a>
@@ -241,7 +245,7 @@ l2 = Label(2, 'Occipital', (  0, 255,   0))
 l3 = Label(3, 'Temporal',  (  0,   0, 255))
 
 print('{} >  {}: {}'.format(l1, l2, l1  > l2))
-print('{} <  {}: {}'.format(l1, l3, l1  < l3))
+print('{} <  {}: {}'.format(l1, l3, l1 <= l3))
 print('{} != {}: {}'.format(l2, l3, l2 != l3))
 print(sorted((l3, l1, l2)))
 ```
@@ -545,7 +549,7 @@ v = Vector((1, 2, 3))
 
 print('v:   ', v)
 print('xyz: ', v.xyz)
-print('yz:  ', v.zy)
+print('zy:  ', v.zy)
 print('xx:  ', v.xx)
 
 v.xz = 10, 30
-- 
GitLab