Commit 99df6758 authored by peastman's avatar peastman
Browse files

Merge pull request #69 from rmcgibbo/pickle2-vec3

Add support for pickle protocol 2 for Vec3
parents 1d1d1390 d1334405
......@@ -40,6 +40,10 @@ class Vec3(tuple):
"""Create a new Vec3."""
return tuple.__new__(cls, (x, y, z))
def __getnewargs__(self):
"Support for pickle protocol 2: http://docs.python.org/2/library/pickle.html#pickling-and-unpickling-normal-class-instances"
return self[0], self[1], self[2]
def __add__(self, other):
"""Add two Vec3s."""
return Vec3(self[0]+other[0], self[1]+other[1], self[2]+other[2])
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment