Iterators & generators (RE: Real Problems with Python)
news at dorb.com
Wed Feb 16 04:43:12 CET 2000
Guess I need to read more doc strings.
getattr (object, name)
The arguments are an object and a string. The string must be the name of one
of the object's attributes. The result is the value of that attribute. For
example, getattr(x, 'foobar') is equivalent to x.foobar.
> yes, unless someone has made a mistake
> and removed it:
> > python
> Python 1.5.2
> Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
> >>> print getattr.__doc__
> getattr(object, name[, default]) -> value
> Get a named attribute from an object; getattr(x, 'y') is equivalent to
> When a default argument is given, it is returned when the attribute
> exist; without it, an exception is raised in that case.
More information about the Python-list