Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e4ac750

Browse files
committed
Tutorial formatting patch by Robin Stocker.
1 parent 9d4ba39 commit e4ac750

7 files changed

Lines changed: 20 additions & 19 deletions

File tree

Doc/tutorial/classes.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -769,7 +769,7 @@ Examples::
769769
>>> valedictorian = max((student.gpa, student.name) for student in graduates)
770770

771771
>>> data = 'golf'
772-
>>> list(data[i] for i in range(len(data)-1,-1,-1))
772+
>>> list(data[i] for i in range(len(data)-1, -1, -1))
773773
['f', 'l', 'o', 'g']
774774

775775

Doc/tutorial/controlflow.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ boundary::
210210
... """Print a Fibonacci series up to n."""
211211
... a, b = 0, 1
212212
... while b < n:
213-
... print(b,end=' ')
213+
... print(b, end=' ')
214214
... a, b = b, a+b
215215
... print()
216216
...
@@ -389,7 +389,7 @@ Functions can also be called using keyword arguments of the form ``keyword =
389389
value``. For instance, the following function::
390390

391391
def parrot(voltage, state='a stiff', action='voom', type='Norwegian Blue'):
392-
print("-- This parrot wouldn't", action, end= ' ')
392+
print("-- This parrot wouldn't", action, end=' ')
393393
print("if you put", voltage, "volts through it.")
394394
print("-- Lovely plumage, the", type)
395395
print("-- It's", state, "!")
@@ -481,7 +481,7 @@ Normally, these ``variadic`` arguments will be last in the list of formal
481481
parameters, because they scoop up all remaining input arguments that are
482482
passed to the function. Any formal parameters which occur after the ``*args``
483483
parameter are 'keyword-only' arguments, meaning that they can only be used as
484-
keywords rather than positional arguments.::
484+
keywords rather than positional arguments. ::
485485
486486
>>> def concat(*args, sep="/"):
487487
... return sep.join(args)
@@ -513,7 +513,7 @@ In the same fashion, dictionaries can deliver keyword arguments with the ``**``\
513513
-operator::
514514

515515
>>> def parrot(voltage, state='a stiff', action='voom'):
516-
... print("-- This parrot wouldn't", action,end=' ')
516+
... print("-- This parrot wouldn't", action, end=' ')
517517
... print("if you put", voltage, "volts through it.", end=' ')
518518
... print("E's", state, "!")
519519
...

Doc/tutorial/datastructures.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ Here we take a list of numbers and return a list of three times each number::
234234

235235
Now we get a little fancier::
236236

237-
>>> [[x,x**2] for x in vec]
237+
>>> [[x, x**2] for x in vec]
238238
[[2, 4], [4, 16], [6, 36]]
239239

240240
Here we apply a method call to each item in a sequence::
@@ -243,7 +243,7 @@ Here we apply a method call to each item in a sequence::
243243
>>> [weapon.strip() for weapon in freshfruit]
244244
['banana', 'loganberry', 'passion fruit']
245245

246-
Using the if-clause we can filter the stream::
246+
Using the :keyword:`if` clause we can filter the stream::
247247

248248
>>> [3*x for x in vec if x > 3]
249249
[12, 18]
@@ -260,7 +260,7 @@ Tuples can often be created without their parentheses, but not here::
260260
>>> [(x, x**2) for x in vec]
261261
[(2, 4), (4, 16), (6, 36)]
262262

263-
Here are some nested for's and other fancy behavior::
263+
Here are some nested for loops and other fancy behavior::
264264

265265
>>> vec1 = [2, 4, 6]
266266
>>> vec2 = [4, 3, -9]
@@ -273,7 +273,7 @@ Here are some nested for's and other fancy behavior::
273273

274274
List comprehensions can be applied to complex expressions and nested functions::
275275

276-
>>> [str(round(355/113.0, i)) for i in range(1,6)]
276+
>>> [str(round(355/113.0, i)) for i in range(1, 6)]
277277
['3.1', '3.14', '3.142', '3.1416', '3.14159']
278278

279279

@@ -469,7 +469,7 @@ with the :func:`zip` function. ::
469469
To loop over a sequence in reverse, first specify the sequence in a forward
470470
direction and then call the :func:`reversed` function. ::
471471

472-
>>> for i in reversed(range(1,10,2)):
472+
>>> for i in reversed(range(1, 10, 2)):
473473
... print(i)
474474
...
475475
9

Doc/tutorial/inputoutput.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ Some examples::
7878
Here are two ways to write a table of squares and cubes::
7979

8080
>>> for x in range(1, 11):
81-
... print(repr(x).rjust(2), repr(x*x).rjust(3),end=' ')
81+
... print(repr(x).rjust(2), repr(x*x).rjust(3), end=' ')
8282
... # Note use of 'end' on previous line
8383
... print(repr(x*x*x).rjust(4))
8484
...
@@ -93,7 +93,7 @@ Here are two ways to write a table of squares and cubes::
9393
9 81 729
9494
10 100 1000
9595

96-
>>> for x in range(1,11):
96+
>>> for x in range(1, 11):
9797
... print('%2d %3d %4d' % (x, x*x, x*x*x))
9898
...
9999
1 1 1

Doc/tutorial/introduction.rst

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ of ``j`` or ``J``. Complex numbers with a nonzero real component are written as
111111

112112
>>> 1j * 1J
113113
(-1+0j)
114-
>>> 1j * complex(0,1)
114+
>>> 1j * complex(0, 1)
115115
(-1+0j)
116116
>>> 3+1j*3
117117
(3+3j)
@@ -271,8 +271,9 @@ with two literals, not with arbitrary string expressions::
271271

272272
Strings can be subscripted (indexed); like in C, the first character of a string
273273
has subscript (index) 0. There is no separate character type; a character is
274-
simply a string of size one. As in Icon, substrings can be specified with the
275-
*slice notation*: two indices separated by a colon. ::
274+
simply a string of size one. As in the Icon programming language, substrings
275+
can be specified with the *slice notation*: two indices separated by a colon.
276+
::
276277

277278
>>> word[4]
278279
'A'
@@ -523,7 +524,7 @@ example::
523524

524525
You can add something to the end of the list::
525526

526-
>>> p[1].append('xtra')
527+
>>> p[1].append('xtra')
527528
>>> p
528529
[1, [2, 3, 'xtra'], 4]
529530
>>> q

Doc/tutorial/modules.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,9 +224,9 @@ Some tips for experts:
224224
files when :option:`-O` is used) for all modules in a directory.
225225

226226
* If using Python in a parallel processing system with a shared file system,
227-
you need to patch python to disable the creation of the compiled files
227+
you need to patch Python to disable the creation of the compiled files
228228
because otherwise the multiple Python interpreters will encounter race
229-
conditions in creating them.
229+
conditions in creating them.
230230

231231

232232
.. _tut-standardmodules:

Doc/tutorial/stdlib2.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ tasks in background while the main program continues to run::
184184
f = zipfile.ZipFile(self.outfile, 'w', zipfile.ZIP_DEFLATED)
185185
f.write(self.infile)
186186
f.close()
187-
print('Finished background zip of: ', self.infile)
187+
print('Finished background zip of:', self.infile)
188188

189189
background = AsyncZip('mydata.txt', 'myarchive.zip')
190190
background.start()

0 commit comments

Comments
 (0)