[Edu-sig] Design patterns

Kirby Urner urnerk at qwest.net
Sat Aug 20 07:28:05 CEST 2005


 
> Now you can do:
> 
>      t = Triangle(3,4,5)
>      t.c, math.degrees(t.C)
>      t.a/math.sin(t.A), t.b/math.sin(t.B), t.c/math.sin(t.C)
>      t.b = t.c = 3
>      t.c, math.degrees(t.C)
>      t.a/math.sin(t.A), t.b/math.sin(t.B), t.c/math.sin(t.C)
> 
> This takes advantage of the fact that property with a single parameter
> defines only the "get value" accessor, and makes setting or deleting
> the property illegal.
> 
> -- Scott David Daniels
> Scott.Daniels at Acm.Org

Totally excellent Scott.  Thank you.

Kirby




More information about the Edu-sig mailing list