diff options
author | Stefan Behnel <stefan_ml@behnel.de> | 2019-02-15 20:35:23 +0100 |
---|---|---|
committer | Stefan Behnel <stefan_ml@behnel.de> | 2019-02-15 20:47:04 +0100 |
commit | b67e556756c82f99d633b82cc4652d0dfcdce3f7 (patch) | |
tree | 2c14538d202c1f8eeaa84a774da0cb7fc2e778a4 /docs/examples/tutorial/cython_tutorial | |
parent | e6a49ace494660793c3e8cd8115277784108dc40 (diff) | |
download | cython-b67e556756c82f99d633b82cc4652d0dfcdce3f7.tar.gz |
Fix line endings.
Diffstat (limited to 'docs/examples/tutorial/cython_tutorial')
-rw-r--r-- | docs/examples/tutorial/cython_tutorial/primes_cpp.pyx | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/docs/examples/tutorial/cython_tutorial/primes_cpp.pyx b/docs/examples/tutorial/cython_tutorial/primes_cpp.pyx index 57bfe9cc2..7b905a27b 100644 --- a/docs/examples/tutorial/cython_tutorial/primes_cpp.pyx +++ b/docs/examples/tutorial/cython_tutorial/primes_cpp.pyx @@ -1,21 +1,21 @@ -# distutils: language=c++
-
-from libcpp.vector cimport vector
-
-def primes(unsigned int nb_primes):
- cdef int n, i
- cdef vector[int] p
- p.reserve(nb_primes) # allocate memory for 'nb_primes' elements.
-
- n = 2
- while p.size() < nb_primes: # size() for vectors is similar to len()
- for i in p:
- if n % i == 0:
- break
- else:
- p.push_back(n) # push_back is similar to append()
- n += 1
-
- # Vectors are automatically converted to Python
- # lists when converted to Python objects.
- return p
+# distutils: language=c++ + +from libcpp.vector cimport vector + +def primes(unsigned int nb_primes): + cdef int n, i + cdef vector[int] p + p.reserve(nb_primes) # allocate memory for 'nb_primes' elements. + + n = 2 + while p.size() < nb_primes: # size() for vectors is similar to len() + for i in p: + if n % i == 0: + break + else: + p.push_back(n) # push_back is similar to append() + n += 1 + + # Vectors are automatically converted to Python + # lists when converted to Python objects. + return p |