[Edu-sig] Uniform Access Principle confusion
Arthur
ajsiegel at optonline.net
Thu Oct 13 18:33:33 CEST 2005
> -----Original Message-----
> From: Kirby Urner [mailto:urnerk at qwest.net]
> Sent: Wednesday, October 12, 2005 2:25 PM
> To: 'Arthur'; edu-sig at python.org
> Subject: RE: [Edu-sig] Uniform Access Principle confusion
>
>
> Note that passing an argument is not the only way to tell an object stuff
> like "my preferred unit of measure." That could also be regarded as a
> change in state, and be handled with another attribute, e.g.:
>
> >>> Triangle.anglemeasure = 'degrees' # set default class attribute
> >>> mytri = Triangle((30,60,90)) # instantiate using degrees
But in my (perhaps overly strict) way of OO thinking the unit of measure is
an attribute of the angle, not of the Triangle.
Is there a way to a accomplish a "change of state" of the angle "attribute",
other by sending it a parameter?
Art
More information about the Edu-sig
mailing list