newb question about @property

Bill BILL_NOSPAM at whoknows.net
Mon Oct 2 21:07:22 EDT 2017


Steve D'Aprano wrote:
>         
> There's no need to set the radius and the diameter, as one is completely derived
> from the other

Good point; I'm glad I submitted my code for grading.  Sort of a "trick 
question" to ask me to add diameter and then take off points because I 
used it!  ; )

Bill



> and the transformation is cheap enough to perform on the fly as
> needed.
>
> Consider what happens if, due to a bug or an accident, you end up with a Circle
> instance that says the radius is 5 and the diameter is 20. They can't *both* be
> right, and




More information about the Python-list mailing list