Buffer type checking cleanup/rewrite (now uses use_utility_code)
[cython.git] / tests / run / unpacklistcomp.pyx
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: ...
7
8     >>> unpack_comp([1,2])
9     (1, 2)
10     >>> unpack_comp([1,2,3]) # doctest: +ELLIPSIS
11     Traceback (most recent call last):
12     ValueError: ...
13
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 """
20
21 def unpack_normal(l):
22     a,b = l
23     return a,b
24
25 def unpack_comp(l):
26     a,b = [ n for n in l ]
27     return a,b
28
29 def unpack_expr(l):
30     a,b = [ n*n for n in l ]
31     return a,b