Initializing the Object

Learn what happens when we try to access the missing attribute and how to resolve it.

Access missing attribute

If we don’t explicitly set the x and y positions on our Point object, either using move() or by accessing them directly, we’ll have a broken Point object with no real position. What will happen when we try to access it? Well, let’s just try it and see. Try it and see is an extremely useful tool for Python study. Open up the interactive interpreter and type away.

The following interactive session shows what happens if we try to access a missing attribute:

Get hands-on with 1200+ tech skills courses.