Paul Dubois schrieb: > Attached is a patch for changes to the tutorial. I made it by doing: > > svn diff tutorial > tutorial.diff > > in the Doc directory. I hope this is what is wanted; if not let me know > what to do. > > Unfortunately cygwin will not run Sphinx correctly even using 2.5, much > less 3.0. And running docutils by hand gets a lot of errors because > Sphinx has hidden a lot of the definitions used in the tutorial. So the > bottom line is I have only an imperfect idea if I have screwed up any > formatting. > > I would like to rewrite the classes.rst file in particular, and it is > the one that I did not check to be sure the examples worked, but first I > need to do something about getting me a real Linux so I don't have these > problems. So unless someone is hot to trot I'd like to remain 'owner' of > this issue on the spreadsheet. > > Whoever puts in these patches, I would appreciate being notified that it > is done. > > Paul
I've had a look at the patch and here's another one against the current py3k, to be applied in the Doc directory. It mostly fixes some code formatting errors, like no space after a comma. Robin Stocker
Index: tutorial/modules.rst =================================================================== --- tutorial/modules.rst (revision 57911) +++ tutorial/modules.rst (working copy) @@ -224,9 +224,9 @@ files when :option:`-O` is used) for all modules in a directory. * If using Python in a parallel processing system with a shared file system, - you need to patch python to disable the creation of the compiled files + you need to patch Python to disable the creation of the compiled files because otherwise the multiple Python interpreters will encounter race - conditions in creating them. + conditions in creating them. .. _tut-standardmodules: Index: tutorial/controlflow.rst =================================================================== --- tutorial/controlflow.rst (revision 57911) +++ tutorial/controlflow.rst (working copy) @@ -210,7 +210,7 @@ ... """Print a Fibonacci series up to n.""" ... a, b = 0, 1 ... while b < n: - ... print(b,end=' ') + ... print(b, end=' ') ... a, b = b, a+b ... print() ... @@ -389,7 +389,7 @@ value``. For instance, the following function:: def parrot(voltage, state='a stiff', action='voom', type='Norwegian Blue'): - print("-- This parrot wouldn't", action, end= ' ') + print("-- This parrot wouldn't", action, end=' ') print("if you put", voltage, "volts through it.") print("-- Lovely plumage, the", type) print("-- It's", state, "!") @@ -481,7 +481,7 @@ parameters, because they scoop up all remaining input arguments that are passed to the function. Any formal parameters which occur after the ``*args`` parameter are 'keyword-only' arguments, meaning that they can only be used as -keywords rather than positional arguments.:: +keywords rather than positional arguments. :: >>> def concat(*args, sep="/"): ... return sep.join(args) @@ -513,7 +513,7 @@ -operator:: >>> def parrot(voltage, state='a stiff', action='voom'): - ... print("-- This parrot wouldn't", action,end=' ') + ... print("-- This parrot wouldn't", action, end=' ') ... print("if you put", voltage, "volts through it.", end=' ') ... print("E's", state, "!") ... Index: tutorial/datastructures.rst =================================================================== --- tutorial/datastructures.rst (revision 57911) +++ tutorial/datastructures.rst (working copy) @@ -234,7 +234,7 @@ Now we get a little fancier:: - >>> [[x,x**2] for x in vec] + >>> [[x, x**2] for x in vec] [[2, 4], [4, 16], [6, 36]] Here we apply a method call to each item in a sequence:: @@ -243,7 +243,7 @@ >>> [weapon.strip() for weapon in freshfruit] ['banana', 'loganberry', 'passion fruit'] -Using the if-clause we can filter the stream:: +Using the :keyword:`if` clause we can filter the stream:: >>> [3*x for x in vec if x > 3] [12, 18] @@ -260,7 +260,7 @@ >>> [(x, x**2) for x in vec] [(2, 4), (4, 16), (6, 36)] -Here are some nested for's and other fancy behavior:: +Here are some nested for loops and other fancy behavior:: >>> vec1 = [2, 4, 6] >>> vec2 = [4, 3, -9] @@ -273,7 +273,7 @@ List comprehensions can be applied to complex expressions and nested functions:: - >>> [str(round(355/113.0, i)) for i in range(1,6)] + >>> [str(round(355/113.0, i)) for i in range(1, 6)] ['3.1', '3.14', '3.142', '3.1416', '3.14159'] @@ -469,7 +469,7 @@ To loop over a sequence in reverse, first specify the sequence in a forward direction and then call the :func:`reversed` function. :: - >>> for i in reversed(range(1,10,2)): + >>> for i in reversed(range(1, 10, 2)): ... print(i) ... 9 Index: tutorial/inputoutput.rst =================================================================== --- tutorial/inputoutput.rst (revision 57911) +++ tutorial/inputoutput.rst (working copy) @@ -78,7 +78,7 @@ Here are two ways to write a table of squares and cubes:: >>> for x in range(1, 11): - ... print(repr(x).rjust(2), repr(x*x).rjust(3),end=' ') + ... print(repr(x).rjust(2), repr(x*x).rjust(3), end=' ') ... # Note use of 'end' on previous line ... print(repr(x*x*x).rjust(4)) ... @@ -93,7 +93,7 @@ 9 81 729 10 100 1000 - >>> for x in range(1,11): + >>> for x in range(1, 11): ... print('%2d %3d %4d' % (x, x*x, x*x*x)) ... 1 1 1 Index: tutorial/introduction.rst =================================================================== --- tutorial/introduction.rst (revision 57911) +++ tutorial/introduction.rst (working copy) @@ -111,7 +111,7 @@ >>> 1j * 1J (-1+0j) - >>> 1j * complex(0,1) + >>> 1j * complex(0, 1) (-1+0j) >>> 3+1j*3 (3+3j) @@ -271,8 +271,9 @@ Strings can be subscripted (indexed); like in C, the first character of a string has subscript (index) 0. There is no separate character type; a character is -simply a string of size one. As in Icon, substrings can be specified with the -*slice notation*: two indices separated by a colon. :: +simply a string of size one. As in the Icon programming language, substrings +can be specified with the *slice notation*: two indices separated by a colon. +:: >>> word[4] 'A' @@ -523,7 +524,7 @@ You can add something to the end of the list:: - >>> p[1].append('xtra') + >>> p[1].append('xtra') >>> p [1, [2, 3, 'xtra'], 4] >>> q Index: tutorial/classes.rst =================================================================== --- tutorial/classes.rst (revision 57911) +++ tutorial/classes.rst (working copy) @@ -769,7 +769,7 @@ >>> valedictorian = max((student.gpa, student.name) for student in graduates) >>> data = 'golf' - >>> list(data[i] for i in range(len(data)-1,-1,-1)) + >>> list(data[i] for i in range(len(data)-1, -1, -1)) ['f', 'l', 'o', 'g'] Index: tutorial/stdlib2.rst =================================================================== --- tutorial/stdlib2.rst (revision 57911) +++ tutorial/stdlib2.rst (working copy) @@ -184,7 +184,7 @@ f = zipfile.ZipFile(self.outfile, 'w', zipfile.ZIP_DEFLATED) f.write(self.infile) f.close() - print('Finished background zip of: ', self.infile) + print('Finished background zip of:', self.infile) background = AsyncZip('mydata.txt', 'myarchive.zip') background.start()
_______________________________________________ Python-3000 mailing list Python-3000@python.org http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com