mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
Convert all print statements in the docs.
This commit is contained in:
parent
c9879246a2
commit
6911e3ce3f
71 changed files with 351 additions and 388 deletions
|
@ -376,7 +376,7 @@ Here is a simple example that demonstrates the behavior of generators and
|
|||
generator functions::
|
||||
|
||||
>>> def echo(value=None):
|
||||
... print "Execution starts when 'next()' is called for the first time."
|
||||
... print("Execution starts when 'next()' is called for the first time.")
|
||||
... try:
|
||||
... while True:
|
||||
... try:
|
||||
|
@ -387,15 +387,15 @@ generator functions::
|
|||
... except Exception, e:
|
||||
... value = e
|
||||
... finally:
|
||||
... print "Don't forget to clean up when 'close()' is called."
|
||||
... print("Don't forget to clean up when 'close()' is called.")
|
||||
...
|
||||
>>> generator = echo(1)
|
||||
>>> print generator.next()
|
||||
>>> print(generator.next())
|
||||
Execution starts when 'next()' is called for the first time.
|
||||
1
|
||||
>>> print generator.next()
|
||||
>>> print(generator.next())
|
||||
None
|
||||
>>> print generator.send(2)
|
||||
>>> print(generator.send(2))
|
||||
2
|
||||
>>> generator.throw(TypeError, "spam")
|
||||
TypeError('spam',)
|
||||
|
@ -640,7 +640,7 @@ A consequence of this is that although the ``*expression`` syntax appears
|
|||
(and the ``**expression`` argument, if any -- see below). So::
|
||||
|
||||
>>> def f(a, b):
|
||||
... print a, b
|
||||
... print(a, b)
|
||||
...
|
||||
>>> f(b=1, *(2,))
|
||||
2 1
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue