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

Re: [pygame] immutable vectors in math package



Lorenz Quack wrote:
I guess, using PyQt4 lately I followed their convention.
Also using methods makes it more explicit that the values are read-only.

I think that in a pure Python library it's more important to
follow Python conventions than those of some other language
or library. If PyQT has that convention, I suspect it gets
it from C++, where read-only attributes are impossible.

While Python values explicitness, I don't think it's an
issue here. Explicitness is about making it clear what the
code is intended to do, and I think it's pretty clear that
'v.x' is meant to retrieve the x coordinate of vector v.
The fact that you can't assign to it is not something that
needs to be made explicit, because the code at that point
isn't trying to do that.

--
Greg