/SimplePythonClassExample

An example of Object-orientation in Python, intended as a teaching-aid for Botball students.

Primary LanguagePython

SimplePythonClassExample

Botball Concept Difficulty: Advanced

An example of Object-orientation in Python, intended as a teaching-aid for Botball students.

A similar example can be found at https://www.digitalocean.com/community/tutorials/how-to-construct-classes-and-define-objects-in-python-3.

Note for those coming from Java: Python objects require an explicit reference to "self", which is not a reserved keyword like "this" is in Java. The reasoning for using "self", and why it is not a reserved keyword, can be found here: http://neopythonic.blogspot.com/2008/10/why-explicit-self-has-to-stay.html.