Skip to content

Commit

Permalink
Typos and other tweaks on demystifying dot notation
Browse files Browse the repository at this point in the history
  • Loading branch information
zstumgoren committed Nov 6, 2023
1 parent b0ee735 commit 48207ab
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions content/demystifying_dot_notation.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@
"\n",
"It's often helpful to think of classes as the molds in a widget factory, used to stamp out new widgets on the assembly line.\n",
"\n",
"It can be hard to understand `self` in the abstract, until we see it being used. The `change_name` method on the class can help drive home the point. Here is the code for that method:\n",
"It can be hard to understand `self` in the abstract, until we see it being used. The `change_name` method on the `Bird` class can help drive home the point. Here is the code for that method:\n",
"\n",
"```python\n",
"def change_name(self, new_name):\n",
Expand All @@ -255,7 +255,7 @@
"id": "11c0dc03-6194-457b-8bda-c2214255c478",
"metadata": {},
"source": [
"You can now verify the name of your bird is different by directly accessing it's `name` attribute:"
"You can now verify the name of your bird is different by directly accessing its `name` attribute:"
]
},
{
Expand Down Expand Up @@ -753,7 +753,7 @@
"source": [
"That did the trick!! We now have a number that updates itself and allows us to repeatedly call the `add` method.\n",
"\n",
"We should note you can use method chaining with different types of objects. For example, we could have done some basic method chaining using our very first implementation of `Number`:"
"It's important to note that you can use method chaining with different types of objects. Stated differently, the methods you're chaining don't all have to live on the same class. For example, we could have done some basic method chaining using our very first implementation of `Number`:"
]
},
{
Expand All @@ -772,7 +772,7 @@
"id": "816ecbe1-ccf7-4b0b-a359-a391a81ed1ad",
"metadata": {},
"source": [
"Above, the `add` method is of course on our original `Number` class. But the `bit_count` method is a (not so frequently used) method on integers. The important point is that you **when you encounter (or use) method chaining, it's critical that you remain aware of the return value at every point in the chain.**\n",
"Above, the `add` method is of course on our original `Number` class. But the `bit_count` method is a (not so frequently used) method on integers. The important point is that **when you encounter (or use) method chaining, it's critical that you remain aware of the return value at every point in the chain.**\n",
"\n",
"If you're ever in doubt, you can rewrite the code to use individual steps. In fact, it can be helpful to apply this approach when first writing the code. Once you're confident the code works as expected, you can _then_ rewrite it into a more compact form using method chaining."
]
Expand Down Expand Up @@ -824,7 +824,7 @@
"source": [
"## Poking and prodding objects\n",
"\n",
"Python provides a few tools to poke and prod your objects, which can be quite helpful when you're trying to unravel what's happen in a series of \"chained\" method calls.\n",
"Python provides a few tools to poke and prod your objects, which can be quite helpful when you're trying to unravel what's happening in a series of \"chained\" method calls.\n",
"\n",
"In particular, the built-in [type function](https://docs.python.org/3/library/functions.html#type) will be a trusted friend.\n",
"\n",
Expand Down Expand Up @@ -927,9 +927,9 @@
"id": "0e5252b2-dac9-40c0-b980-2b13d1e31c96",
"metadata": {},
"source": [
"Aha! We can see that our original data has now been grouped by the `first` name, and the data structure has stored references to the row (or \"index\" in pandas lingo) where each name appear. \n",
"Aha! We can see that our original data has now been grouped by the `first` name, and the data structure has stored references to the row (or \"index\" in pandas lingo) where each name appears. \n",
"\n",
"> NOTE: The `dir` function can be handy, but we also encourage you to first review the official documentation for a class or function once you've determined what it is using the `type` function. That's perhaps the more \"normal\" course of action.\n",
"> NOTE: The `dir` function can be handy, but we also encourage you to first review the official documentation for a class or function once you've determined whether it's a class or some other kind of object using the `type` function. That's a natural -- and arguably more \"normal\" or traditional -- coding workflow.\n",
"\n",
"Armed with these tools, we can rinse and repeat this process for each method call."
]
Expand Down

0 comments on commit 48207ab

Please sign in to comment.