Commit 15e05cfc authored by scoder's avatar scoder Committed by GitHub

Merge pull request #2150 from gabrieldemarmiesse/cython_tutorial

Made the print python 3 style. pep8 and link to memoryviews.
parents 0d93a2ba 26b12c26
...@@ -2,5 +2,5 @@ def fib(n): ...@@ -2,5 +2,5 @@ def fib(n):
"""Print the Fibonacci series up to n.""" """Print the Fibonacci series up to n."""
a, b = 0, 1 a, b = 0, 1
while b < n: while b < n:
print b, print(b)
a, b = b, a + b a, b = b, a + b
...@@ -34,7 +34,7 @@ things in getting started is just figuring out how to compile your extension. ...@@ -34,7 +34,7 @@ things in getting started is just figuring out how to compile your extension.
So lets start with the canonical python hello world:: So lets start with the canonical python hello world::
print "Hello World" print("Hello World")
Save this code in a file named :file:`helloworld.pyx`. Now we need to create Save this code in a file named :file:`helloworld.pyx`. Now we need to create
the :file:`setup.py`, which is like a python Makefile (for more information the :file:`setup.py`, which is like a python Makefile (for more information
...@@ -85,7 +85,7 @@ Cython will still fail to compile a lot of Python modules, in which ...@@ -85,7 +85,7 @@ Cython will still fail to compile a lot of Python modules, in which
case the import mechanism will fall back to loading the Python source case the import mechanism will fall back to loading the Python source
modules instead. The .py import mechanism is installed like this:: modules instead. The .py import mechanism is installed like this::
>>> pyximport.install(pyimport = True) >>> pyximport.install(pyimport=True)
Note that it is not recommended to let :mod:`pyximport` build code Note that it is not recommended to let :mod:`pyximport` build code
on end user side as it hooks into their import system. The best way on end user side as it hooks into their import system. The best way
...@@ -170,5 +170,5 @@ Language Details ...@@ -170,5 +170,5 @@ Language Details
For more about the Cython language, see :ref:`language-basics`. For more about the Cython language, see :ref:`language-basics`.
To dive right in to using Cython in a numerical computation context, To dive right in to using Cython in a numerical computation context,
see :ref:`numpy_tutorial`. see :ref:`memoryviews`.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment