Hi Christopher,
good question.
Currently the Vector types are implemented in a C-extension and I'm not sure how to subclass from a pure python object
in C. I'm sure it's possible just that I've never done it before.
But I am afraid that you would have to go through the Python API to access any attributes from the C side which would
have a negative impact on performance.
Another alternative would be to implement the whole thing in pure python, which certainly is a possibility. Just one
that I didn't pursue.
Cheers,
Lorenz
On 30/10/14 01:14, Christopher Night wrote:
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.ew...@canterbury.ac.nz
<mailto:greg.ew...@canterbury.ac.nz>> 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