Cython has moved to github.
cython-devel
view tests/run/unpacklistcomp.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 | b0765ab5c39c |
| children | 82d312a9f1fc |
line source
1 __doc__ = u"""
2 >>> unpack_normal([1,2])
3 (1, 2)
4 >>> unpack_normal([1,2,3]) # doctest: +ELLIPSIS
5 Traceback (most recent call last):
6 ValueError: ...
8 >>> unpack_comp([1,2])
9 (1, 2)
10 >>> unpack_comp([1,2,3]) # doctest: +ELLIPSIS
11 Traceback (most recent call last):
12 ValueError: ...
14 >>> unpack_expr([1,2])
15 (1, 4)
16 >>> unpack_expr([1,2,3]) # doctest: +ELLIPSIS
17 Traceback (most recent call last):
18 ValueError: ...
19 """
21 def unpack_normal(l):
22 a,b = l
23 return a,b
25 def unpack_comp(l):
26 a,b = [ n for n in l ]
27 return a,b
29 def unpack_expr(l):
30 a,b = [ n*n for n in l ]
31 return a,b
