Item with a class attribute tax_rate = 0.18 shared by all items and an instance attribute price. Method gross() returns price with tax. Changing Item.tax_rate must affect every existing instance — that is the point of putting it on the class.a = Item(100); Item.tax_rate = 0.05; a.gross()
105.0
The class-level change reaches the already-created instance.
Define tax_rate directly in the class body.
self.tax_rate finds the class attribute when no instance one exists.