The Attribute (.) Operator

The dot (.) operator is used to access the attributes of an object. For example:

foo.x = 3
print foo.y
a = foo.bar(3,4,5)

More than one dot operator can appear in a single expression, such as in foo.y.a.b. The dot operator can also be applied to the intermediate results of functions, as in a = foo.bar(3,4,5).spam.

Get Python: Essential Reference, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.