You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: concepts/comparisons/about.md
+6-5Lines changed: 6 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -29,7 +29,7 @@ Numeric types are (mostly) an exception to this type matching rule.
29
29
An `integer`**can** be considered equal to a `float` (_or an [`octal`][octal] equal to a [`hexadecimal`][hex]_), as long as the types can be implicitly converted for comparison.
30
30
31
31
For the other numeric types ([complex][complex numbers], [decimal][decimal numbers], [fractions][rational numbers]), comparison operators are defined where they "make sense" (_where implicit conversion does not change the outcome_), but throw a `TypeError` if the underlying objects cannot be accurately converted for comparison.
32
-
For more information on the rules that python uses for numeric conversion, see [arithmetic conversions][arithmetic conversions] in the Python documentation.
32
+
For more information on the rules that Python uses for numeric conversion, see [arithmetic conversions][arithmetic conversions] in the Python documentation.
33
33
34
34
```python
35
35
>>>import fractions
@@ -47,7 +47,8 @@ True
47
47
>>>6/3==0b10
48
48
True
49
49
50
-
# An int can be converted to a complex number with a 0 imaginary part.
50
+
# An int can be converted to a complex
51
+
# number with a 0 imaginary part.
51
52
>>>17==complex(17)
52
53
True
53
54
@@ -60,8 +61,8 @@ True
60
61
```
61
62
62
63
Any ordered comparison of a number to a `NaN` (_not a number_) type is `False`.
63
-
A confusing side-effect of Python's `NaN` definition is that `NaN` never compares equal to `NaN`.
64
-
If you are curious as to why `Nan` was defined this way in Python, this [Stack Overflow Post on NaN][so nan post] around the setting of the international standard is an interesting read.
64
+
A confusing sideeffect of Python's `NaN` definition is that `NaN` never compares equal to `NaN`.
65
+
If you are curious as to why `NaN` was defined this way in Python, this [Stack Overflow Post on NaN][so nan post] around the setting of the international standard is an interesting read.
65
66
66
67
```python
67
68
>>> x =float('NaN')
@@ -188,7 +189,7 @@ See the Python reference docs on [value comparisons][value comparisons none] and
188
189
>>> my_fav_numbers is your_fav_numbers
189
190
True
190
191
191
-
# The returned id will differ by system and python version.
192
+
# The returned id will differ by system and Python version.
0 commit comments