@@ -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
5555Just by defining ``__enter__ `` and ``__exit__ `` methods we can use it in
@@ -76,7 +76,7 @@ Let's talk about what happens under-the-hood.
7676Handling 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 ``
8080arguments of the ``__exit__ `` method. Between the 4th and 6th step, if
8181an exception occurs, Python passes the type, value and traceback of the
8282exception 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