[Python-3000-checkins] r65545 - in python/branches/py3k/Doc/tutorial: controlflow.rst inputoutput.rst introduction.rst modules.rst

georg.brandl python-3000-checkins at python.org
Tue Aug 5 11:04:17 CEST 2008


Author: georg.brandl
Date: Tue Aug  5 11:04:16 2008
New Revision: 65545

Log:
#3503: fix print statements in 3k doc.


Modified:
   python/branches/py3k/Doc/tutorial/controlflow.rst
   python/branches/py3k/Doc/tutorial/inputoutput.rst
   python/branches/py3k/Doc/tutorial/introduction.rst
   python/branches/py3k/Doc/tutorial/modules.rst

Modified: python/branches/py3k/Doc/tutorial/controlflow.rst
==============================================================================
--- python/branches/py3k/Doc/tutorial/controlflow.rst	(original)
+++ python/branches/py3k/Doc/tutorial/controlflow.rst	Tue Aug  5 11:04:16 2008
@@ -434,7 +434,7 @@
    def cheeseshop(kind, *arguments, **keywords):
        print("-- Do you have any", kind, '?')
        print("-- I'm sorry, we're all out of", kind)
-       for arg in arguments: print arg
+       for arg in arguments: print(arg)
        print('-'*40)
        keys = sorted(keywords.keys())
        for kw in keys: print(kw, ':', keywords[kw])

Modified: python/branches/py3k/Doc/tutorial/inputoutput.rst
==============================================================================
--- python/branches/py3k/Doc/tutorial/inputoutput.rst	(original)
+++ python/branches/py3k/Doc/tutorial/inputoutput.rst	Tue Aug  5 11:04:16 2008
@@ -208,7 +208,7 @@
 operation. For example::
 
    >>> import math
-   >>> print 'The value of PI is approximately %5.3f.' % math.pi
+   >>> print('The value of PI is approximately %5.3f.' % math.pi)
    The value of PI is approximately 3.142.
 
 Since :meth:`str.format` is quite new, a lot of Python code still uses the ``%``

Modified: python/branches/py3k/Doc/tutorial/introduction.rst
==============================================================================
--- python/branches/py3k/Doc/tutorial/introduction.rst	(original)
+++ python/branches/py3k/Doc/tutorial/introduction.rst	Tue Aug  5 11:04:16 2008
@@ -599,16 +599,12 @@
      >>> print('The value of i is', i)
      The value of i is 65536
 
-   The keyword end can be used to avoid the newline after the output::
+  The keyword *end* can be used to avoid the newline after the output, or end
+  the output with a different string::
 
      >>> a, b = 0, 1
      >>> while b < 1000:
-     ...     print(b, ' ', end='')
+     ...     print(b, end=' ')
      ...     a, b = b, a+b
      ... 
-     >>> print()
      1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987
-
- Note that nothing appeared after the loop ended, until we printed
- a newline.
-

Modified: python/branches/py3k/Doc/tutorial/modules.rst
==============================================================================
--- python/branches/py3k/Doc/tutorial/modules.rst	(original)
+++ python/branches/py3k/Doc/tutorial/modules.rst	Tue Aug  5 11:04:16 2008
@@ -32,6 +32,7 @@
        while b < n:
            print(b, end=' ')
            a, b = b, a+b
+       print()
 
    def fib2(n): # return Fibonacci series up to n
        result = []


More information about the Python-3000-checkins mailing list