Cython has moved to github.
cython-devel
view tests/run/listcomp.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 | 421a3edf1abf |
| children | 82d312a9f1fc |
line source
1 __doc__ = u"""
2 >>> smoketest()
3 [0, 4, 8]
4 >>> int_runvar()
5 [0, 4, 8]
6 >>> typed()
7 [A, A, A]
8 >>> iterdict()
9 [1, 2, 3]
10 """
12 def smoketest():
13 print [x*2 for x in range(5) if x % 2 == 0]
15 def int_runvar():
16 cdef int x
17 print [x*2 for x in range(5) if x % 2 == 0]
19 cdef class A:
20 def __repr__(self): return u"A"
22 def typed():
23 cdef A obj
24 print [obj for obj in [A(), A(), A()]]
26 def iterdict():
27 cdef dict d = dict(a=1,b=2,c=3)
28 l = [d[key] for key in d]
29 l.sort()
30 print l
