@@ -36,7 +36,7 @@ program is read and executed by another piece of software, the Python
3636interpreter. The Python interpreter takes a sequence of Python statements and
3737performs the actions they specify. The interpreter takes care of allocating the
3838required memory and causes the right sequences of primitive machine-level
39- instructions to execute on the actual hardware for your programme to run .
39+ instructions to execute on the actual hardware such that your programme runs .
4040
4141The Python interpreter is the same no matter whether you use Jupyter
4242notebooks, an interactive Python terminal such as IPython, or execute
@@ -85,7 +85,7 @@ This will result in output simiar to the following:
8585
8686 In [1]:
8787
88- Just like in a Jupyter notebook, this last line is the Python prompt at which
88+ Just as in a Jupyter notebook, this last line is the Python prompt at which
8989you can type any Python you like. If you press return after a complete Python
9090statement, the statement will execute immediately. Unlike in a Jupyter
9191notebook, there is no special key combination or button to trigger execution.
@@ -104,8 +104,8 @@ and edit Python files with a program called a text editor. A good text
104104editor will help you to code by highlighting syntax and helping with
105105indentation. Some text editors also feature advanced features such as
106106built-in access to documentation, or highlighting style problems in
107- your code. A more fully-featured option is an Integrated Development
108- Environment (IDE). IDEs combine an editor with a Python interpreter to
107+ your code. A more fully-featured option is an :term: ` integrated development
108+ environment ` (IDE). IDEs combine an editor with a Python interpreter to
109109run your code, a debugger and often other features such as integration
110110with Git.
111111
@@ -394,8 +394,16 @@ from the module (without any warning or error). This is a frequent
394394source of confusion. For this reason, importing `* ` is usually a bad
395395idea.
396396
397- The full details of all the ways that the import statement can be used
398- is in :ref: `the official Python documentation. <python:import >`
397+ .. only :: not book
398+
399+ The full details of all the ways that the import statement can be used
400+ is in :ref: `the official Python Language Reference. <python:import >`
401+
402+ .. only :: book
403+
404+ The full details of all the ways that the import statement can be used
405+ is in the official Python Language Reference. [#import ]_
406+
399407
400408Packages
401409--------
@@ -577,11 +585,22 @@ about all of the packages in the current repository, but this can be
577585automated with the :func: `~setuptools.find_packages ` function, which
578586will return a list of folders containing a file named :file: `__init__.py `.
579587
580- This very simple :file: `setup.py ` will suffice for packages that you only
581- intend to use yourself. Should you wish to publish packages for use by
582- other people, then you'll need to add some more information to the
583- file. The canonical guide to this is the `Python Packaging User Guide
584- <https://packaging.python.org/tutorials/packaging-projects/> `__.
588+ .. only :: not book
589+
590+ This very simple :file: `setup.py ` will suffice for packages that you only
591+ intend to use yourself. Should you wish to publish packages for use by other
592+ people, then you'll need to provide significantly more information in
593+ :file: `setup.py ` and, potentially, in other places too. The canonical guide to
594+ this is the `Python Packaging User Guide
595+ <https://packaging.python.org/tutorials/packaging-projects/> `__.
596+
597+ .. only :: book
598+
599+ This very simple :file: `setup.py ` will suffice for packages that you only
600+ intend to use yourself. Should you wish to publish packages for use by
601+ other people, then you'll need to provide significantly more information in
602+ :file: `setup.py ` and, potentially, in other places too. The canonical guide
603+ to this is the Python Packaging User Guide. [#packaging ]_
585604
586605Installing a package from local code
587606~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -687,7 +706,7 @@ including tests in your code here.
687706
688707There are a number of Python packages which support code testing. The concepts
689708are largely similar so rather than get bogged down in the details of multiple
690- frameworks, we will introduce :doc: `pytest <pytest:index >`, which is one of the
709+ frameworks, we will introduce :doc: `Pytest <pytest:index >`, which is one of the
691710most widely used. Pytest is simply a Python package, so you can install it into
692711your current environment using:
693712
@@ -798,11 +817,11 @@ wrong. We will learn how to interpret this output in :numref:`Chapter %s
798817<errors_and_exceptions>`.
799818
800819
801- Additional useful pytest tricks
820+ Additional useful Pytest tricks
802821~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
803822
804823It can be useful to run a specific test file, which is achieved simply by naming
805- that file as the argument to pytest . For example:
824+ that file as the argument to Pytest . For example:
806825
807826.. code-block :: console
808827
@@ -818,7 +837,7 @@ It is even possible to select an individual test to run, using a double colon
818837 Often if one test fails then the same problem in your code will cause a whole
819838series of tests to fail, resulting in a very long list of error messages which
820839is hard to read. A useful tool in this circumstance is the `-x ` option, which
821- tells pytest to stop after the first test fail. For example:
840+ tells Pytest to stop after the first test fail. For example:
822841
823842.. code-block :: console
824843
@@ -831,12 +850,12 @@ only move onto the next problem when the previous test passes.
831850
832851.. note ::
833852
834- The exercise repositories provided here will contain a :file: ` tests ` folder
835- full of tests that check that you have correctly implemented the week's
836- exercises. You should get in the habit of running the tests as you work
837- through the exercises, as they are designed not just to pass if your code
838- is correct, but to provide feedback as to what might be going wrong if your
839- code contains errors.
853+ The exercise repositories that accompany this book will contain a
854+ :file: ` tests ` folder full of tests that check that you have correctly
855+ implemented the chaper's exercises. You should get in the habit of running
856+ the tests as you work through the exercises, as they are designed not just
857+ to pass if your code is correct, but to provide feedback as to what might
858+ be going wrong if your code contains errors.
840859
841860Writing code to a specified interface
842861-------------------------------------
@@ -937,7 +956,7 @@ Exercises
937956 <https://github.com/object-oriented-python/object-oriented-programming> `__.
938957 Clone that git repository into your course folder, and install the Python
939958 package it contains into your virtual environment. Check that it has
940- installed correctly by installing pytest , and running:
959+ installed correctly by installing Pytest , and running:
941960
942961 .. code-block :: console
943962
@@ -1008,4 +1027,11 @@ Exercises
10081027
10091028 .. rubric :: Footnotes
10101029
1011- .. [#peters ] Tim Peters, `"PEP 20 -- The Zen Of Python" (2004) <https://www.python.org/dev/peps/pep-0020/ >`__
1030+ .. [#peters ] Tim Peters, `"PEP 20 -- The Zen Of Python" (2004)
1031+ <https://www.python.org/dev/peps/pep-0020/> `__
1032+
1033+ .. [#import ] `https://docs.python.org/3/reference
1034+ <https://docs.python.org/3/reference/simple_stmts.html#import> `__
1035+
1036+ .. [#packaging ] `https://packaging.python.org
1037+ <https://packaging.python.org/tutorials/packaging-projects/> `__
0 commit comments