home *** CD-ROM | disk | FTP | other *** search
- <TITLE>Special Attributes -- Python library reference</TITLE>
- Prev: <A HREF="../o/other_built-in_types" TYPE="Prev">Other Built-in Types</A>
- Up: <A HREF="../t/types" TYPE="Up">Types</A>
- Top: <A HREF="../t/top" TYPE="Top">Top</A>
- <H2>2.1.8. Special Attributes</H2>
- The implementation adds a few special read-only attributes to several
- object types, where they are relevant:
- <P>
- <UL>
- <LI>• <CODE><VAR>x</VAR>.__dict__</CODE> is a dictionary of some sort used to store an
- object's (writable) attributes;
- <P>
- <LI>• <CODE><VAR>x</VAR>.__methods__</CODE> lists the methods of many built-in object types,
- e.g., <CODE>[].__methods__</CODE> yields
- <CODE>['append', 'count', 'index', 'insert', 'remove', 'reverse', 'sort']</CODE>;
- <P>
- <LI>• <CODE><VAR>x</VAR>.__members__</CODE> lists data attributes;
- <P>
- <LI>• <CODE><VAR>x</VAR>.__class__</CODE> is the class to which a class instance belongs;
- <P>
- <LI>• <CODE><VAR>x</VAR>.__bases__</CODE> is the tuple of base classes of a class object.
- <P>
- </UL>
-