Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Doc/tutorial/errors.rst
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ Handlers only handle exceptions that occur in the corresponding *try clause*,
not in other handlers of the same :keyword:`!try` statement. An *except clause*
may name multiple exceptions, for example::

... except RuntimeError, TypeError, NameError:
... except (RuntimeError, TypeError, NameError):
Comment thread
ByteFlowing1337 marked this conversation as resolved.
Outdated
... pass

A class in an :keyword:`except` clause matches exceptions which are instances of the
Expand Down
7 changes: 3 additions & 4 deletions Doc/tutorial/stdlib2.rst
Original file line number Diff line number Diff line change
Expand Up @@ -178,14 +178,13 @@ tasks in background while the main program continues to run::

class AsyncZip(threading.Thread):
def __init__(self, infile, outfile):
threading.Thread.__init__(self)
super().__init__()
self.infile = infile
self.outfile = outfile

def run(self):
f = zipfile.ZipFile(self.outfile, 'w', zipfile.ZIP_DEFLATED)
f.write(self.infile)
f.close()
with zipfile.ZipFile(self.outfile, 'w', zipfile.ZIP_DEFLATED) as f:
f.write(self.infile)
print('Finished background zip of:', self.infile)

background = AsyncZip('mydata.txt', 'myarchive.zip')
Expand Down
Loading