Linux/Unix > Python Essential Reference, Second Edition > 4. Operators and Expressions > The Attribute ( . ) Operator | See All Titles

< BACK | Make Note | Bookmark | CONTINUE >

155117184014003188065099048180054212144238241179195140058238110137104030195079253249172173

### 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)
    del foo.x

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`. An attribute can be deleted using the `del` statement as in `del foo.x`.

| Last updated on 3/28/2002 Python Essential Reference, Second Edition, © 2002 New Riders Publishing

< BACK | Make Note | Bookmark | CONTINUE >

© 2002, O'Reilly & Associates, Inc.