"prove"

hdante hdante at gmail.com
Thu May 8 18:21:01 EDT 2008


On May 8, 10:50 am, "Lucas Prado Melo" <luca... at dcc.ufba.br> wrote:
> Hello,
> How could I "prove" to someone that python accepts this syntax using
> the documentation (I couldn't find it anywhere):
> classname.functionname(objectname)

 It's in the language reference, section 3.2 "The standard type
hierarchy", subsection "Classes". The relevant paragraphs are those:

Classes
    Class objects are created by class definitions (see section 7.7,
``Class definitions''). A class has a namespace implemented by a
dictionary object. Class attribute references are translated to
lookups in this dictionary, e.g., "C.x" is translated to
"C.__dict__["x"]". When the attribute name is not found there, the
attribute search continues in the base classes. The search is depth-
first, left-to-right in the order of occurrence in the base class
list.

    When a class attribute reference (for class C, say) would yield a
user-defined function object or an unbound user-defined method object
whose associated class is either C or one of its base classes, it is
transformed into an unbound user-defined method object whose im_class
attribute is C. When it would yield a class method object, it is
transformed into a bound user-defined method object whose im_class and
im_self attributes are both C. When it would yield a static method
object, it is transformed into the object wrapped by the static method
object. See section 3.4.2 for another way in which attributes
retrieved from a class may differ from those actually contained in its
__dict__.

 http://docs.python.org/ref/types.html



More information about the Python-list mailing list