|
1 | | -# Defining and using custom classes in Python |
| 1 | +# Defining and using custom classes |
2 | 2 |
|
3 | 3 | When I was getting started in Python I learned to make classes for |
4 | 4 | tkinter GUI's before I understood how they work. Everything I did with |
5 | 5 | classes worked, but I didn't understand how. Hopefully you'll first |
6 | 6 | learn to understand classes, and then learn to use them. |
7 | 7 |
|
8 | | -## Why should I use custom classes in my projects? |
| 8 | +## What are classes? |
9 | 9 |
|
10 | | -Python comes with a lot of classes that you are already familiar with. |
| 10 | +Python comes with many classes that we know already. |
11 | 11 |
|
12 | 12 | ```python |
13 | 13 | >>> str |
@@ -51,11 +51,11 @@ We can also get an instance's class with `type()`: |
51 | 51 | >>> |
52 | 52 | ``` |
53 | 53 |
|
54 | | -Let's say you make a program that processes data about websites. With a |
55 | | -custom class, you're not limited to `str`, `int` and other classes |
56 | | -Python comes with. Instead you can define a Website class, and make |
57 | | -Websites and process information about websites directly. Defining your |
58 | | -own object types like this is called **object-orientated programming**. |
| 54 | +Let's say that we make a program that processes data about websites. |
| 55 | +With a custom class, we're not limited to `str`, `int` and other classes |
| 56 | +Python comes with. Instead we can define a Website class, and make |
| 57 | +Websites and process information about websites directly. Defining our |
| 58 | +own types like this is called **object-orientated programming**. |
59 | 59 |
|
60 | 60 | ## First class |
61 | 61 |
|
|
0 commit comments