Using Python object properties to write smarter and more concise code