Skip to content

Instantly share code, notes, and snippets.

@MrfksIv
Created November 2, 2018 10:41
Show Gist options
  • Save MrfksIv/93b8babada106fee821b9a1a704a7138 to your computer and use it in GitHub Desktop.
Save MrfksIv/93b8babada106fee821b9a1a704a7138 to your computer and use it in GitHub Desktop.
The fibonacci function written in Cython
def fib(int n):
cdef int i
cdef double a=0.0, b=1.0
for i in range(n):
a, b = a+b, a
return a
from distutils.core import setup
from Cython.Build import cythonize
setup(ext_modules = cythonize('fibonacci_cython.pyx')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment