[Edu-sig] Natural Language Programming
Kirby Urner
pdx4d@teleport.com
Thu, 11 Jan 2001 02:04:46 -0800
>Too hard! It's enough to do
>
> move = translate
>
And let's not forget, while we're at it, that a
synonym for a word might by another symbol, like *,
thanks to the "operator override" feature.
>From my real "poly" class (polyhedron), written before
I'd forgotten what Tim just showed me:
class Poly:
<<SNIP>>
__mul__ = scale
__rmul__ = __mul__
>>> import polys
>>> a = polys.Octa()
>>> b = a*3
>>> b
Octa: origin=(0.0, 0.0, 0.0); volume=108.0
>>> c = a.scale(3)
>>> c
Octa: origin=(0.0, 0.0, 0.0); volume=108.0
Kirby