blob: 2d5890d9bf0bc80ea11fd79dbfe891e5e057b18c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
# ticket: 601
cdef unsigned long size2():
return 3
def for_from_plain_ulong():
"""
>>> for_from_plain_ulong()
0
1
2
"""
cdef object j = 0
for j from 0 <= j < size2():
print j
def for_in_plain_ulong():
"""
>>> for_in_plain_ulong()
0
1
2
"""
cdef object j = 0
for j in range(size2()):
print j
cdef extern from *:
"""typedef unsigned long Ulong;"""
ctypedef unsigned long Ulong
cdef Ulong size():
return 3
def for_from_ctypedef_ulong():
"""
>>> for_from_ctypedef_ulong()
0
1
2
"""
cdef object j = 0
for j from 0 <= j < size():
print j
def for_in_ctypedef_ulong():
"""
>>> for_in_ctypedef_ulong()
0
1
2
"""
cdef object j = 0
for j in range(size()):
print j
class ForFromLoopInPyClass(object):
"""
>>> ForFromLoopInPyClass.i # doctest: +ELLIPSIS
Traceback (most recent call last):
AttributeError: ...ForLoopInPyClass... has no attribute ...i...
>>> ForFromLoopInPyClass.k
0
>>> ForFromLoopInPyClass.m
1
"""
for i from 0 <= i < 1:
pass
for k from 0 <= k < 2:
pass
for m from 0 <= m < 3:
pass
|