Page 343 - Beginning Programming with Pyth - John Paul Mueller
P. 343
attributes provide specific functionality for your class. They’re also common to every other class you create, so you can count on always having this functionality in the classes you create.
2. Type help(′__class__′) and press Enter.
Python displays information on the __class__ attribute, as partially shown in Figure 15-4. You can use the same technique for learning more about any attribute that Python adds to your class.
FIGURE 15-3: Use the dir() function to determine which built-in attributes are present.
FIGURE 15-4: Python provides help for each of the attributes it adds to your class.
Working with methods
Methods are simply another kind of function that reside in classes. You create and work with methods in precisely the same way that you do functions, except that methods are always associated with a class (you