~ubuntu-branches/ubuntu/precise/cython/precise

« back to all changes in this revision

Viewing changes to tests/run/for_from_float_T254.pyx

  • Committer: Bazaar Package Importer
  • Author(s): Python Applications Packaging Team, Ryan Kavanagh, Jakub Wilk, Piotr Ożarowski
  • Date: 2009-08-10 23:18:51 UTC
  • mfrom: (1.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20090810231851-i6f7mr1ij1h2czkp
Tags: 0.11.2-1
[ Ryan Kavanagh ]
* New upstream release (Closes: #525620, #536213)

[ Jakub Wilk ]
* debian/rules: remove generated files.

[ Piotr Ożarowski ]
* Standards-Version bumped to 3.8.2 (no change needed)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
__doc__ = u"""
 
2
    >>> double_target(0, 4)
 
3
    at 0.0
 
4
    at 1.0
 
5
    at 2.0
 
6
    at 3.0
 
7
    4.0
 
8
    >>> double_step(0, 2, .5)
 
9
    at 0.0
 
10
    at 0.5
 
11
    at 1.0
 
12
    at 1.5
 
13
    2.0
 
14
    >>> double_step_typed(0, 2, .5)
 
15
    at 0.0
 
16
    at 0.5
 
17
    at 1.0
 
18
    at 1.5
 
19
    2.0
 
20
    >>> double_step_py_target(0, 2, .5)
 
21
    at 0.0
 
22
    at 0.5
 
23
    at 1.0
 
24
    at 1.5
 
25
    2.0
 
26
    >>> int_step_py_target(0, 2, 1)
 
27
    at 0
 
28
    at 1
 
29
    2
 
30
"""
 
31
 
 
32
def double_target(a, b):
 
33
    cdef double x
 
34
    for x from a <= x < b:
 
35
        print u"at", x
 
36
    return x
 
37
 
 
38
def double_step(a, b, dx):
 
39
    cdef double x
 
40
    for x from a <= x < b by dx:
 
41
        print u"at", x
 
42
    return x
 
43
 
 
44
def double_step_typed(a, b, double dx):
 
45
    cdef double x
 
46
    for x from a <= x < b by dx:
 
47
        print u"at", x
 
48
    return x
 
49
 
 
50
def double_step_py_target(a, b, double dx):
 
51
    cdef object x
 
52
    for x from a <= x < b by dx:
 
53
        print u"at", x
 
54
    return x
 
55
 
 
56
def int_step_py_target(a, b, int dx):
 
57
    cdef object x
 
58
    for x from a <= x < b by dx:
 
59
        print u"at", x
 
60
    return x