1__doc__ = u""" 2 >>> a = A(1,2,3) 3 >>> a[0] 4 1.0 5 >>> a[1] 6 2.0 7 >>> a[2] 8 3.0 9""" 10 11cdef class A: 12 cdef double[3] x 13 14 def __init__(self, *args): 15 cdef int i, max 16 max = len(args) 17 if max > 3: 18 max = 3 19 for i from 0 <= i < max: 20 self.x[i] = args[i] 21 22 def __getitem__(self,i): 23 return self.x[i] 24