Home > Articles > Open Source > Python

Deitel Presents Python Properties

  • Print
  • + Share This
Deitel™ explains how to implement properties for a class in Python.
Like this article? We recommend

Like this article? We recommend

This article describes how to implement properties for a class. Properties are new to the Python language--they were added in version 2.2. Properties enable the programmer to provide access methods on a per-attribute basis. We discuss how to define get, set and delete methods for a private attribute and how to create properties that use these methods to manipulate the attributes. Readers should be familiar with OOP (constructors, the object reference argument, private attributes, class customization) and raising exceptions. The code examples included in this article show readers examples using the Deitel™ signature Live-Code™ Approach.

View the entire article in PDF format.

  • + Share This
  • 🔖 Save To Your Account