Commit 4e07f391 authored by Tom Niget's avatar Tom Niget

Add numpy to ext example

parent 9104072b
import pyext
print("Imported:", pyext.add(5, 3), pyext.fibo(10))
\ No newline at end of file
print("Imported:", pyext.add(5, 3), pyext.fibo(10), pyext.squares())
\ No newline at end of file
# coding: utf-8
# extension
def add(x, y):
import numpy as np
def add(x, y) -> int:
return x + y
def fibo(n):
......@@ -10,5 +12,8 @@ def fibo(n):
res.append(res[i - 1] + res[i - 2])
return res
def squares() -> list[int]:
return np.square([x for x in range(5)])
if __name__ == "__main__":
print("Python:", add(5, 3), fibo(10))
\ No newline at end of file
print("Python:", add(5, 3), fibo(10), squares())
\ No newline at end of file
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