AI engineering glossary · Python advanced

What is class attribute?

Class attribute: A variable defined in the body of a class rather than on an individual object, so all objects of the class share one value. Reading it through an object works, but assigning through an object creates a separate instance attribute instead.

Level: intermediateTopic: Python advanced

Class attribute: an example

class Tax: rate = 0.18 Tax.rate is 0.18 for every Tax object, like a shared GST rate.

Related terms

More Python advanced terms

Where you learn it

Class attribute is part of the AI Engineering Program, which teaches it with notes, a hands-on lab and an exam. The first lesson is free.

Before you go

Take the cheat sheet with you

One free PDF: the key AI-engineering terms, formulas and Python idioms. No spam; unsubscribe any time.