In Python, you define a class by using the
class
keyword followed by a name and a colon. Then you use.__init__()
to declare which attributes each instance of the class should have:
Click through for an introduction to object-orientation as it exists in Python. I have my strong functional programming biases—which is part of why I don’t particularly love Python as a programming language—but if you are going to get comfortable with Python, you’ll get a lot of value out of learning how classes work.
Comments closed