October 2018
Beginner to intermediate
466 pages
12h 2m
English
If we don't explicitly set the x and y positions on our Point object, either using move or by accessing them directly, we have a broken point 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 your interactive interpreter and type away. The following interactive session shows what happens if we try to access a missing attribute. If you saved the previous example as a file or are using the examples distributed with the book, you can load it into the Python interpreter with the python -i more_arguments.py command:
>>> point = Point() >>> point.x = 5 >>> print(point.x) 5 >>> print(point.y) Traceback (most ...
Read now
Unlock full access