Skip to content

Commit 7230e80

Browse files
committed
Converted "trace_back" to "traceback"
1 parent fe4b2b8 commit 7230e80

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

context_managers.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ Manager and learn the basics.
4949
self.file_obj = open(file_name, method)
5050
def __enter__(self):
5151
return self.file_obj
52-
def __exit__(self, type, value, trace_back):
52+
def __exit__(self, type, value, traceback):
5353
self.file_obj.close()
5454

5555
Just by defining ``__enter__`` and ``__exit__`` methods we can use it in
@@ -76,7 +76,7 @@ Let's talk about what happens under-the-hood.
7676
Handling exceptions
7777
^^^^^^^^^^^^^^^^^^^
7878

79-
We did not talk about the ``type``, ``value`` and ``trace_back``
79+
We did not talk about the ``type``, ``value`` and ``traceback``
8080
arguments of the ``__exit__`` method. Between the 4th and 6th step, if
8181
an exception occurs, Python passes the type, value and traceback of the
8282
exception to the ``__exit__`` method. It allows the ``__exit__`` method
@@ -122,7 +122,7 @@ Let's try handling the exception in the ``__exit__`` method:
122122
self.file_obj = open(file_name, method)
123123
def __enter__(self):
124124
return self.file_obj
125-
def __exit__(self, type, value, trace_back):
125+
def __exit__(self, type, value, traceback):
126126
print "Exception has been handled"
127127
self.file_obj.close()
128128
return True

0 commit comments

Comments
 (0)