Skip to content

Commit

Permalink
Small RST format fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
natenka committed Oct 15, 2020
1 parent f62f634 commit d768bef
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 24 deletions.
2 changes: 1 addition & 1 deletion docs/source/book/01_intro/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
.. _intro_index:

1. Preparing for work
**********************
=====================

In order to start working with Python, you need to decide on a few things:

Expand Down
10 changes: 5 additions & 5 deletions docs/source/book/03_start/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
============================


This section examines:
This section covers:

- Python syntax
- Work in interactive mode
Expand All @@ -18,8 +18,8 @@ This section examines:
.. toctree::
:maxdepth: 1

0_syntax
1_ipython
1a_ipython_magic
2_variables
syntax
ipython
ipython_magic
variables
../../exercises/03_exercises
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ Interpreter makes it possible to receive an instant response to executed actions
In previous section, a standard interpreter was called to verify Python installation. There is also an improved interpreter `IPython <http://ipython.readthedocs.io/en/stable/index.html>`__.
Ipython allows much more than standard interpreter called by "python" command. Some examples (Ipython features are much broader):

- Autocomplete Tab commands or hints if there are more than one command variant;
- More structured and understandable output of commands;
- Automatic indentation in loops and other objects;
- You can either walk through the command execution history or watch it with %history 'magic' command.
- Autocomplete Tab commands or hints if there are more than one command variant
- More structured and understandable output of commands
- Automatic indentation in loops and other objects
- You can either walk through the command execution history or watch it with %history 'magic' command

You can install Ipython using pip (installation will be done in a virtual environment if configured):

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
Python syntax
~~~~~~~~~~~~~~~~

The first thing that meets the eye when it comes to Python syntax is that indentation matters:
The first thing that tends to catch your eye when it comes to Python syntax is that indentation matters:

- It determines which code enters the block;
- When a block of code starts and ends.
- It determines which code is inside the block
- When a block of code starts and ends

Example of Python code:

Expand All @@ -29,10 +29,10 @@ Example of Python code:
print("Ready")
.. note::
This code is shown for syntax demonstration. Although if/else construction has not yet been considered, it is likely that the meaning of code will be understood.
This code is shown for syntax demonstration. Although if/else construction has not yet been covered, it is likely that the meaning of code will be clear in general.

Python understands which lines refer to "if" on indentation basis.
Execution of a block ``if a > b`` ends when another string with the same indent as string ``if a > b`` appears. Similarly to block else.
Execution of a block ``if a > b`` ends when another string with the same indent as string ``if a > b`` appears. Similarly to block ``else``.
The second feature of Python is that some expressions must be followed by colon (for example, after ``if a > b`` and after ``else``).

Several rules and recommendations on indentation:
Expand All @@ -59,9 +59,9 @@ Comments in Python can be one-line:
a = 10
b = 5 # A much needed comment
One-line comments start with pound sign. Note that comment can be in line where code itself is or in a separate line.
One-line comments start with hash sign. Note that comment can be in line where code itself is or in a separate line.

If it is necessary to write several lines with comments in order to not put pound sign before each line, you can make a multi-line comment:
If it is necessary to write several lines with comments in order to not put hash sign before each line, you can make a multi-line comment:

.. code:: python
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ Variables

Variables in Python do not require variable type declaration (since Python is a language with dynamic typing) and they are references to a memory area. Variable naming rules:

- Name of variable can consist only of letters, digits and an underscore;
- Name cannot start with a digit;
- Name cannot contain special characters @, $, %.
- Name of variable can consist only of letters, digits and an underscore
- Name cannot start with a digit
- Name cannot contain special characters @, $, %

An example of creating variables in Python:

Expand All @@ -22,7 +22,7 @@ An example of creating variables in Python:
Note that Python does not need to specify that "a" is a number, and "b" is a string.

Variables are references to memory area. This can be demonstrated by using id() which shows object ID:
Variables are references to memory area. This can be demonstrated by using ``id()`` which shows object ID:

.. code:: python
Expand Down Expand Up @@ -100,7 +100,7 @@ Variable names

Variable names should not overlap with names of operators and modules or other reserved words. Python has recommendations for naming functions, classes and variables:

- variable names are usually written in lowercase or in uppercase (e.g., DB_NAME, db_name);
- function names are written in lowercase, with underline between words (for example get_names);
- class names are given with capital letters without spaces, it is called CamelCase (for example, CiscoSwitch).
- variable names are usually written in lowercase or in uppercase (e.g., DB_NAME, db_name)
- function names are written in lowercase, with underline between words (for example get_names)
- class names are given with capital letters without spaces, it is called CamelCase (for example, CiscoSwitch)

0 comments on commit d768bef

Please sign in to comment.