Skip to content

Commit a9588cb

Browse files
committed
lots of fixed tracebacks
1 parent a8fd02e commit a9588cb

File tree

6 files changed

+59
-50
lines changed

6 files changed

+59
-50
lines changed

doc/source/10_further_object-oriented_features.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -327,9 +327,9 @@ be observed if we try to instantiate :class:`~example_code.groups_abc.Group`:
327327
In [1]: from example_code.groups_abc import Group
328328
329329
In [2]: Group(1)
330-
---------------------------------------------------------------------------
331-
TypeError Traceback (most recent call last)
332-
<ipython-input-2-76d67216101e> in <module>
330+
--------------------------------------------------------------------------
331+
TypeError Traceback (most recent call last)
332+
Cell In [2], line 1
333333
----> 1 Group(1)
334334
335335
TypeError: Can't instantiate abstract class Group with abstract methods _validate, operation, symbol

doc/source/2_programs_in_files.rst

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -711,7 +711,7 @@ packages that are not already available before installing the package itself.
711711

712712
.. warning::
713713

714-
Neither `dependencies` nor `requires`should list packages from the Python
714+
Neither `dependencies` nor `requires` should list packages from the Python
715715
Standard Library. These are always available, and listing them will cause
716716
Pip to error.
717717

@@ -769,13 +769,12 @@ it's false, then an error occurs. For example:
769769

770770
.. code-block:: ipython3
771771
772-
In [1]: assert 1 == 0
773-
---------------------------------------------------------------------------
774-
AssertionError Traceback (most recent call last)
775-
<ipython-input-1-e99f91a18d62> in <module>
776-
----> 1 assert 1 == 0
772+
--------------------------------------------------------------------------
773+
AssertionError Traceback (most recent call last)
774+
Cell In [1], line 1
775+
----> 1 assert 1==0
777776
778-
AssertionError:
777+
AssertionError:
779778
780779
Pytest files
781780
~~~~~~~~~~~~
@@ -804,6 +803,12 @@ are usually gathered in a separate tests folder. For example::
804803
│ └── test_fibonacci.py
805804
└── pyproject.toml
806805

806+
.. only:: book
807+
808+
.. raw:: latex
809+
810+
\clearpage
811+
807812
We can then invoke the tests from the shell:
808813

809814
.. code-block:: console
@@ -1068,12 +1073,6 @@ already familiar with Git and GitHub then you will also need to work through
10681073
GitHub. Then ensure that the tests pass on GitHub. For more information
10691074
about how to do any of these, refer to :numref:`Appendix %s <git>`.
10701075

1071-
.. only:: book
1072-
1073-
.. raw:: latex
1074-
1075-
\clearpage
1076-
10771076
.. proof:exercise::
10781077
10791078
Following :numref:`installable_packages`, create a :file:`pyproject.toml`

doc/source/3_objects.rst

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,17 @@ we add an integer to a :ref:`string <textseq>`?
4141

4242
.. code-block:: ipython3
4343
44-
In [1]: a = 1
45-
In [2]: b = 'og'
46-
In [3]: print(a + b)
47-
---------------------------------------------------------------------------
48-
TypeError Traceback (most recent call last)
49-
<ipython-input-3-0ae8b1612688> in <module>
50-
----> 1 print(a + b)
51-
52-
TypeError: unsupported operand type(s) for +: 'int' and 'str'
44+
In [1]: a = 1
45+
46+
In [2]: b = 'og'
47+
48+
In [3]: print(a + b)
49+
--------------------------------------------------------------------------
50+
TypeError Traceback (most recent call last)
51+
Cell In [3], line 1
52+
----> 1 print(a + b)
53+
54+
TypeError: unsupported operand type(s) for +: 'int' and 'str'
5355
5456
In this error, Python is complaining that `+` does not make sense if
5557
the items being added (the :term:`operands`) are an integer and a
@@ -62,15 +64,17 @@ also in trouble:
6264

6365
.. code-block:: ipython3
6466
65-
In [1]: a = {1, 2}
66-
In [2]: b = {2, 3}
67-
In [3]: print(a + b)
68-
---------------------------------------------------------------------------
69-
TypeError Traceback (most recent call last)
70-
<ipython-input-3-0ae8b1612688> in <module>
71-
----> 1 print(a + b)
72-
73-
TypeError: unsupported operand type(s) for +: 'set' and 'set'
67+
In [1]: a = {1, 2}
68+
69+
In [2]: b = {2, 3}
70+
71+
In [3]: print(a + b)
72+
--------------------------------------------------------------------------
73+
TypeError Traceback (most recent call last)
74+
Cell In [3], line 1
75+
----> 1 print(a + b)
76+
77+
TypeError: unsupported operand type(s) for +: 'set' and 'set'
7478
7579
Conversely we might suspect that two values can be added only if they are of the same
7680
type. However it is perfectly legal to add an integer and a :ref:`floating
@@ -700,9 +704,9 @@ Let's try our new addition functionality in action:
700704
x^3 + 2x + 2
701705
702706
In [8]: print(1 + a)
703-
---------------------------------------------------------------------------
704-
TypeError Traceback (most recent call last)
705-
<ipython-input-8-a42ff1c9a542> in <module>
707+
--------------------------------------------------------------------------
708+
TypeError Traceback (most recent call last)
709+
Cell In [8], line 1
706710
----> 1 print(1 + a)
707711
708712
TypeError: unsupported operand type(s) for +: 'int' and 'Polynomial'

doc/source/4_style.rst

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1000,11 +1000,22 @@ information:
10001000
File: ~/docs/principles_of_programming/object-oriented-programming/fibonacci/fibonacci.py
10011001
Type: function
10021002
1003-
Finally, the same information is used in the :func:`web documentation
1004-
<fibonacci.fibonacci.fib>`. Notice that the :term:`function signature` is not a
1005-
part of the docstring. Python is capable of extracting the signature of the
1006-
function and adding it into the documentation without the programmer having to
1007-
manually add it to the docstring.
1003+
.. only:: not book
1004+
1005+
Finally, the same information is used in the :func:`web documentation
1006+
<fibonacci.fibonacci.fib>`. Notice that the :term:`function signature` is
1007+
not a part of the docstring. Python is capable of extracting the signature
1008+
of the function and adding it into the documentation without the programmer
1009+
having to manually add it to the docstring.
1010+
1011+
.. only:: book
1012+
1013+
Finally, the same information is used in the web documentation
1014+
of the function. Notice that the :term:`function signature` is
1015+
not a part of the docstring. Python is capable of extracting the signature
1016+
of the function and adding it into the documentation without the programmer
1017+
having to manually add it to the docstring.
1018+
10081019

10091020
Where to use docstrings
10101021
.......................

doc/source/7_inheritance.rst

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -595,12 +595,6 @@ than the current one with:
595595
Observe that since `type(self)` is a :term:`class`, we can :term:`instantiate`
596596
it by calling it.
597597

598-
.. only:: book
599-
600-
.. raw:: latex
601-
602-
\clearpage
603-
604598
Calling parent class methods
605599
----------------------------
606600

doc/source/conf.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
# General information about the project.
6262
project = u'Object-oriented Programming'
6363
author = u'David A. Ham'
64-
copyright = u'2019-2021, David A. Ham'
64+
copyright = u'2019-2023, David A. Ham'
6565

6666
mathjax_path = \
6767
"https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" # noqa 501
@@ -71,7 +71,7 @@
7171
# built documents.
7272
#
7373
# The short X.Y version.
74-
version = '2021.0'
74+
version = '2023.0'
7575
# The full version, including alpha/beta/rc tags.
7676
release = ''
7777

@@ -255,6 +255,7 @@
255255
\title{Object-oriented Programming}
256256
\subtitle{in Python for Mathematicians}
257257
\edition{2021}
258+
\edition{2023}
258259
\makeatletter
259260
\fancypagestyle{normal}{
260261
\fancyhf{}

0 commit comments

Comments
 (0)