Tutorial update for 3.0 by Paul Dubois.

I had to fix a few markup issues in controlflow.rst and modules.rst.

There's a unicode issue on line 448 in introduction.rst that someone else needs to fix.
This commit is contained in:
Guido van Rossum 2007-08-31 03:25:11 +00:00
parent 8b2af27dae
commit 0616b792ba
12 changed files with 379 additions and 353 deletions

View file

@ -184,14 +184,14 @@ tasks in background while the main program continues to run::
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()
print 'The main program continues to run in foreground.'
print('The main program continues to run in foreground.')
background.join() # Wait for the background task to finish
print 'Main program waited until background was done.'
print('Main program waited until background was done.')
The principal challenge of multi-threaded applications is coordinating threads
that share data or other resources. To that end, the threading module provides
@ -309,7 +309,7 @@ tree searches::
>>> from collections import deque
>>> d = deque(["task1", "task2", "task3"])
>>> d.append("task4")
>>> print "Handling", d.popleft()
>>> print("Handling", d.popleft())
Handling task1
unsearched = deque([starting_node])