You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: source/rst/python_oop.rst
+18-18
Original file line number
Diff line number
Diff line change
@@ -148,7 +148,7 @@ OOP is useful for the same reason that abstraction is useful: for recognizing an
148
148
149
149
For example,
150
150
151
-
* *a Markov chain* consists of a set of states, an initial probability distribution over states, and a collection of transition probabilities for moving across states
151
+
* *a Markov chain* consists of a set of states, an initial probability distribution over states, and a collection of probabilities of moving across states
152
152
153
153
* *a general equilibrium theory* consists of a commodity space, preferences, technologies, and an equilibrium definition
154
154
@@ -213,7 +213,7 @@ For example
213
213
print("w0,w1,w2,w3,w4 = ", w0,w1,w2,w3,w4)
214
214
215
215
216
-
A Class bundles a set of data tied to a particular *instance* together with a collection of functions that operate on the data.
216
+
A *Class* bundles a set of data tied to a particular *instance* together with a collection of functions that operate on the data.
217
217
218
218
In our example, an *instance* will be the name of particular *person* whose *instance data* consist solely of its wealth.
219
219
@@ -302,7 +302,7 @@ After we create consumer :math:`c1` and endow it with initial wealth :math:`10`,
302
302
c1.spend(100)
303
303
304
304
305
-
We can of course create multiple instanceseach with its own data
305
+
We can of course create multiple instances, i.e., multiple consumers, each with its own name and data
306
306
307
307
.. code-block:: python3
308
308
@@ -316,7 +316,7 @@ We can of course create multiple instances each with its own data
316
316
c1.wealth
317
317
318
318
319
-
In fact, each instance stores its data in a separate namespace dictionary
319
+
Each instance, i.e., each consumer, stores its data in a separate namespace dictionary
320
320
321
321
.. code-block:: python3
322
322
@@ -340,9 +340,9 @@ The rules for using ``self`` in creating a Class are that
340
340
341
341
* Any instance data should be prepended with ``self``
342
342
343
-
* e.g., the ``earn`` method references ``self.wealth`` rather than just ``wealth``
343
+
* e.g., the ``earn`` method uses ``self.wealth`` rather than just ``wealth``
344
344
345
-
* Any method defined within the class should have ``self`` as its first argument
345
+
* A method defined within the code that defines the class should have ``self`` as its first argument
346
346
347
347
* e.g., ``def earn(self, y)`` rather than just ``def earn(y)``
348
348
@@ -355,7 +355,7 @@ Details
355
355
356
356
In this section, we look at some more formal details related to classes and ``self``
357
357
358
-
* You might wish to skip to :ref:`the next section <oop_solow_growth>` on first pass of this lecture.
358
+
* You might wish to skip to :ref:`the next section <oop_solow_growth>` the first time you read this lecture.
359
359
360
360
* You can return to these details after you've familiarized yourself with more examples.
361
361
@@ -412,8 +412,8 @@ Example: The Solow Growth Model
412
412
413
413
For our next example, let's write a simple class to implement the Solow growth model.
414
414
415
-
The Solow growth model is a neoclassical growth model where the amount of
416
-
capital stock per capita :math:`k_t` evolves according to the rule
415
+
The Solow growth model is a neoclassical growth model in which the per capita
416
+
capital stock :math:`k_t` evolves according to the rule
417
417
418
418
.. math::
419
419
:label: solow_lom
@@ -423,13 +423,13 @@ capital stock per capita :math:`k_t` evolves according to the rule
423
423
424
424
Here
425
425
426
-
* :math:`s` is an exogenously given savings rate
426
+
* :math:`s` is an exogenously given saving rate
427
427
* :math:`z` is a productivity parameter
428
428
* :math:`\alpha` is capital's share of income
429
429
* :math:`n` is the population growth rate
430
430
* :math:`\delta` is the depreciation rate
431
431
432
-
The **steady state** of the model is the:math:`k` that solves :eq:`solow_lom` when :math:`k_{t+1} = k_t = k`.
432
+
A **steady state** of the model is a:math:`k` that solves :eq:`solow_lom` when :math:`k_{t+1} = k_t = k`.
433
433
434
434
Here's a class that implements this model.
435
435
@@ -512,7 +512,7 @@ The common steady state is also plotted for comparison
0 commit comments