diff options
Diffstat (limited to 'Doc/tutorial')
-rw-r--r-- | Doc/tutorial/classes.rst | 14 | ||||
-rw-r--r-- | Doc/tutorial/controlflow.rst | 3 | ||||
-rw-r--r-- | Doc/tutorial/interactive.rst | 2 | ||||
-rw-r--r-- | Doc/tutorial/modules.rst | 4 |
4 files changed, 12 insertions, 11 deletions
diff --git a/Doc/tutorial/classes.rst b/Doc/tutorial/classes.rst index 8c45d1a..ef6498e 100644 --- a/Doc/tutorial/classes.rst +++ b/Doc/tutorial/classes.rst @@ -497,7 +497,7 @@ call-next-method and is more powerful than the super call found in single-inheritance languages. Dynamic ordering is necessary because all cases of multiple inheritance exhibit -one or more diamond relationships (where one at least one of the parent classes +one or more diamond relationships (where at least one of the parent classes can be accessed through multiple paths from the bottommost class). For example, all classes inherit from :class:`object`, so any case of multiple inheritance provides more than one path to reach :class:`object`. To keep the base classes @@ -707,12 +707,12 @@ returns an object with a :meth:`__next__` method. If the class defines Generators ========== -Generators are a simple and powerful tool for creating iterators. They are -written like regular functions but use the :keyword:`yield` statement whenever -they want to return data. Each time :func:`next` is called on it, the generator -resumes where it left-off (it remembers all the data values and which statement -was last executed). An example shows that generators can be trivially easy to -create:: +:term:`Generator`\s are a simple and powerful tool for creating iterators. They +are written like regular functions but use the :keyword:`yield` statement +whenever they want to return data. Each time :func:`next` is called on it, the +generator resumes where it left-off (it remembers all the data values and which +statement was last executed). An example shows that generators can be trivially +easy to create:: def reverse(data): for index in range(len(data)-1, -1, -1): diff --git a/Doc/tutorial/controlflow.rst b/Doc/tutorial/controlflow.rst index 5a182a9..5d815d6 100644 --- a/Doc/tutorial/controlflow.rst +++ b/Doc/tutorial/controlflow.rst @@ -266,8 +266,9 @@ like in C, procedures are just functions that don't return a value. In fact, technically speaking, procedures do return a value, albeit a rather boring one. This value is called ``None`` (it's a built-in name). Writing the value ``None`` is normally suppressed by the interpreter if it would be the only value -written. You can see it if you really want to:: +written. You can see it if you really want to using :keyword:`print`:: + >>> fib(0) >>> print(fib(0)) None diff --git a/Doc/tutorial/interactive.rst b/Doc/tutorial/interactive.rst index 11a970f..56890cd 100644 --- a/Doc/tutorial/interactive.rst +++ b/Doc/tutorial/interactive.rst @@ -123,7 +123,7 @@ interpreter. :: # bound to the Esc key by default (you can change it - see readline docs). # # Store the file in ~/.pystartup, and set an environment variable to point - # to it: "export PYTHONSTARTUP=/max/home/itamar/.pystartup" in bash. + # to it: "export PYTHONSTARTUP=/home/user/.pystartup" in bash. # # Note that PYTHONSTARTUP does *not* expand "~", so you have to put in the # full path to your home directory. diff --git a/Doc/tutorial/modules.rst b/Doc/tutorial/modules.rst index 7e14a19..4d8b48f 100644 --- a/Doc/tutorial/modules.rst +++ b/Doc/tutorial/modules.rst @@ -191,8 +191,8 @@ Some tips for experts: * When the Python interpreter is invoked with the :option:`-O` flag, optimized code is generated and stored in :file:`.pyo` files. The optimizer currently doesn't help much; it only removes :keyword:`assert` statements. When - :option:`-O` is used, *all* bytecode is optimized; ``.pyc`` files are ignored - and ``.py`` files are compiled to optimized bytecode. + :option:`-O` is used, *all* :term:`bytecode` is optimized; ``.pyc`` files are + ignored and ``.py`` files are compiled to optimized bytecode. * Passing two :option:`-O` flags to the Python interpreter (:option:`-OO`) will cause the bytecode compiler to perform optimizations that could in some rare |