Skip to content

Commit 380375e

Browse files
Merge pull request #2994 from enkidevs/classes-iii
Classes iii
2 parents 1686075 + 31ae7ee commit 380375e

File tree

3 files changed

+6
-8
lines changed

3 files changed

+6
-8
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -479,6 +479,7 @@ Types of change:
479479
### Changed
480480
- [Html - Link Relative Paths - Change part of PQ as it wasn't worder properly](https://github.com/enkidevs/curriculum/pull/2985)
481481
- [Python - Format Text Paragraphs With Textwrap - Make the fill method more clear](https://github.com/enkidevs/curriculum/pull/2981)
482+
- [Python - Classes III - Move single-line commands to a single line, update indentation in codeblocks from 4 to 2 spaces](https://github.com/enkidevs/curriculum/pull/2994)
482483
- [Python - Advanced Referencing - Move single-line commands to a single line, update indentation in codeblocks from 4 to 2 spaces](https://github.com/enkidevs/curriculum/pull/2989)
483484
- [Python - Python Recipes - Move single-line commands to a single line, update indentation in codeblocks from 4 to 2 spaces](https://github.com/enkidevs/curriculum/pull/3009)
484485
- [Python - Is Your Python Healthy - Move single-line commands to a single line, update indentation in codeblocks from 4 to 2 spaces](https://github.com/enkidevs/curriculum/pull/2999)

python/python-core/classes-iii/dynamically-create-types.md

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ This `type` function takes three arguments:
4040
- `bases` - list of superclasses
4141
- `dict` - dictionary of attributes
4242

43-
These two classes implement the same functionality although syntacticly different
43+
These two classes implement the same functionality although syntactically different:
4444

4545
```python
4646
# The name is set to "BigCar"
@@ -55,12 +55,9 @@ def Car_init(self, name):
5555
self.name = name
5656

5757
# We can choose the name of a class
58-
SmallCar = type("BigCar",
59-
(),
60-
{"counter": 0,
61-
"__init__": Car_init,
62-
"beep": lambda self: "Beep " +
63-
self.name})
58+
SmallCar = type("BigCar", (), \
59+
{"counter": 0, "__init__": Car_init, \
60+
"beep": lambda self: "Beep " + self.name})
6461
```
6562

6663
So now these two classes are practically identical (`__name__` property is also equal), the only difference can be seen in types, which does not affect the functionality:

python/python-core/classes-iii/special-attributes-of-objects-and-classes.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ Suppose we have the class:
3434

3535
```python
3636
class Enki:
37-
pi = 3.14
37+
pi = 3.14
3838
```
3939

4040
Get all **writable** attributes of your `class object`:

0 commit comments

Comments
 (0)