Skip to content

Commit

Permalink
Converted "trace_back" to "traceback"
Browse files Browse the repository at this point in the history
  • Loading branch information
yasoob committed Aug 17, 2015
1 parent fe4b2b8 commit 7230e80
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions context_managers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ Manager and learn the basics.
self.file_obj = open(file_name, method)
def __enter__(self):
return self.file_obj
def __exit__(self, type, value, trace_back):
def __exit__(self, type, value, traceback):
self.file_obj.close()

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

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

0 comments on commit 7230e80

Please sign in to comment.