Advance Your Python Skills

Attributes in Python — 6 Concepts to Know

Better understand Python as a unique OOP language.

Yong Cui
The Startup
Published in
8 min readJun 23, 2020

--

Photo by Federico Tasin on Unsplash

In the modern programming world, object-oriented programming (OOP) languages have played an evolutionary role in changing the design and implementation patterns in software development. As a critical member of the OOP family, Python has gradually gained popularity in the last 10 years or so. Like other OOP languages, Python operates its data around a vast diversity of objects, including modules, classes, and functions.

If you have any coding experience in any OOP language, you should probably know that all objects have their internal characteristics data called fields, attributes, or properties. In Python, these object-bound characteristics data are commonly known as attributes. In this article, I would like to talk about them, specifically in the context of a custom class.

1. Class Attributes

To better manage data in our projects, we often need to create custom classes. In Python, classes are objects too, which means that they can have their own attributes. Let’s see an example.

--

--

Yong Cui
The Startup

Work at the nexus of biomedicine, data science & mobile dev. Author of Python How-to by Manning (https://www.manning.com/books/python-how-to).