Skip to content

Commit 0a12c33

Browse files
authored
Add warning about old-style classes
1 parent decae03 commit 0a12c33

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

classes.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,13 @@ Let's use it to define an empty class.
6363
>>>
6464
```
6565

66+
**_Note_:** If you are using Python 2 I highly recommend using
67+
`class Website(object):` instead of `class Website:`. This creates a
68+
new-style class instead of an old-style class. Old-style classes are
69+
different than new-style classes in some ways and not supported in this
70+
tutorial. In Python 3, there are no old-style classes and
71+
`class Website(object):` does the same thing as `class Website:`.
72+
6673
Note that I named the class `Website`, not `website`. This way we know
6774
that it's a class. Built-in classes use lowercase names (like `str`
6875
instead of `Str`) because they are faster to type, but use CapsWord

0 commit comments

Comments
 (0)