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