Attributes at Python.

Lucia Rodriguez
1 min readJun 4, 2019

Coding in Python has a beautiful workflow if you’ve got hit by C too much time. At least that has been my opinion.

One of the most amazing features of Python is all about Object oriented programming (OOP), a way to wrap data structures and functions in one body, that you can call Object. There’s all kinds of object in Python (I’ve learned that even a Object meta class exists)but for the OOP the class object is pivotal.

But what is a class? Through the documentation provided to us I found a really nice example. Think about cars. Every car has common features: doors, windows, wheels, capacity, material, type of motor, a required fuel, car model and so on. A car as a category will be a class in Python. On the other hand, a particular car (the family Renault Logan, your neighbors Chevrolet Spark) is known as an instance of a class and every instance has particular features that makes it unique but still has common characteristics with all cars. This features, while of a particular car or common to all of them, are called call attributes. The particular attributes of a given car are the instance attributes.

Python is more carefree about how you can add and manipulate data inside a function, but this can lead to some difficulties like allowing duplicate data, or unwanted unified instances. So, the pythonic way of handle class and instances attributes is through methods that you establish in the very own definition of the class.

--

--