Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import spam, numpy
- a = spam.vector3d()
- a[0] = 1
- a[1] = 2
- a[2] = 3
- print a
- b = numpy.array([1.4, 1.1, 0.7])
- print b
- m = memoryview(a)
- print m.ndim
- print m.shape
- print m.tobytes()
- c = a + b
- print c
- //////////////////////////////////////////////////////////////////////////////////
- xxx@ThinkPad-E525:~/Workspace/experimental/buffer protocol/swig$ python example.py
- <Swig Object of type 'vector3d *' at 0x7f21a2d76260>
- [ 1.4 1.1 0.7]
- 1
- (3L,)
- �?@
- [ 2.4 3.1 3.7]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement