[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] immutable vectors in math package



I have not used either the original API nor yours, so this suggestion may be off base, but if they're going to be immutable, why not subclass collections.namedtuple("Vector2", "x y"), and get a few handy methods defined for free?

-Christopher

On Wed Oct 29 2014 at 7:41:54 PM Greg Ewing <greg.ewing@xxxxxxxxxxxxxxxx> wrote:
Lorenz Quack wrote:

>Â * you cannot access the components x/y/z directly...
Â> use ... new accessor methods x()/y()/z()

Is this change really necessary? It will be a big backward
step for code readability.

There shouldn't be any reason you can't provide read-only
access using attribute notation.

--
Greg