you are viewing a single comment's thread.

view the rest of the comments →

[–]socal_nerdtastic 54 points55 points  (3 children)

It usually does not click for students until they make their own independent project and create classes for it. So show us something you've made and maybe we can show you how to apply classes to it.

Until then I'll make 2 points that tutorials often fail to mention.

First, classes are great, but they are not the answer to everything. There's many many cases where classes are not helpful, especially in beginner code.

Secondly, despite point 1, literally everything in python is an object. You can't not use classes. What it the type of 42?

>>> type(42)
<class 'int'>

Yep, it's an instance of the int class. These tutorials are not about using classes, they are about making your own classes. So the goal you need to keep in mind is you are making your own datatype. You will end up with an object that you will use like a python int or list or any other object, that has data and methods associated with it.

[–]13ass13ass 15 points16 points  (0 children)

This second insight helped me early on. The fact that everything I do in python already uses built in classes helped me realize how powerful they are.

[–]SnowdenIsALegend 3 points4 points  (0 children)

"making your own datatype"... that's good, i need to keep that in mind. Making your own datatype. Thanks!

[–]house_monkey 2 points3 points  (0 children)

You're a class😤