We're back after a server migration that caused effbot.org to fall over a bit harder than expected. Expect some glitches.

Attribute references

An attribute reference is a primary followed by a period and a name.


primary . identifier

The primary must evaluate to an object of a type that supports attribute references, e.g., a module, list, or an instance. This object is then asked to produce the attribute whose name is the identifier. If this attribute is not available, the exception AttributeError is raised. Otherwise, the type and value of the object produced is determined by the object. Multiple evaluations of the same attribute reference may yield different objects.

Attribute reference targets

Attribute references can also appear as assignment targets.

The primary expression in the reference is evaluated. It should yield an object with assignable attributes; if this is not the case, TypeError is raised. That object is then asked to assign the assigned object to the given attribute; if it cannot perform the assignment, it raises an exception (usually but not necessarily AttributeError).