Cython has moved to github.
cython-devel
view tests/run/lepage_1.pyx @ 1622:4f0327bdebc9
test for temp allocation bug in call
| author | Robert Bradshaw <robertwb@math.washington.edu> |
|---|---|
| date | Sat Jan 17 01:25:34 2009 -0800 (3 years ago) |
| parents | ff6249a604c2 |
| children |
line source
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 """
11 cdef class A:
12 cdef double x[3]
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]
22 def __getitem__(self,i):
23 return self.x[i]
