File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -527,13 +527,13 @@ Creating a new context manager
527
527
528
528
Do you remember the `with ` statement from the `files ` chapter? Where we used a
529
529
context manager to make sure that the file is closed after we are done? The
530
- same style is used in many places where we can the resources to be cleaned
531
- after the work, sometimes we want to call some extra functions when we are
530
+ same style is used in many places where we want the resources to be cleaned up
531
+ after the work is done; sometimes we want to call some extra functions when we are
532
532
done. We can write our own context manager in our classs using `__enter__ ` and
533
533
`__exit__ ` methods.
534
534
535
535
For example, we will create a new class called `TimeLog ` which in turn will
536
- create a file called `tmpdata.txt ` in the current directory and logs the time
536
+ create a file called `tmpdata.txt ` in the current directory to log the time
537
537
this context manager is created and when it is done.
538
538
539
539
::
@@ -566,7 +566,7 @@ Output in the `tmpdata.txt` file.
566
566
Entering at 1590551277.323565
567
567
Done at 1590551277.3238761
568
568
569
- Later in the book we will learn even simpler method to create context managers.
569
+ Later in the book we will learn even simpler methods to create context managers.
570
570
571
571
Deep down inside
572
572
=================
You can’t perform that action at this time.
0 commit comments