tuples and cartesian coordinates
Steve Horsley
shoot at the.moon
Wed Dec 17 18:58:24 EST 2003
Gerrit Holl wrote:
> Hi,
>
> the FAQ says:
>
>
>>For example, a Cartesian coordinate is appropriately represented as a
>>tuple of two or three numbers.
>
>
> I find it strange to use tuples for a coordinate. After all, a
> coordinate represents a position of an object. Suppose I have a game
> where the player has a position: isn't it stupid to use tuples rather
> than lists or another type (maybe complex numbers?), because I want to
> be able to change the position?
>
> Shouldn't coordinates be mutable?
>
> yours,
> Gerrit.
>
Depends. Does it make logical sense for the coordinate to be mutable
in the context of your app?
If an object is returning an instrumentation value, as in
positionNow = spaceship.getPosition()
then it does make sense to be mutable. Of course the spaceship itself
may well keep a mutable position internally that it changes in
response to
setThrusters(fullSpeedAhead)
Steve
More information about the Python-list
mailing list