Hacker News new | ask | show | jobs
by yeldarb 2602 days ago
You mentioned it but, for those who don’t know:

As a stopgap while all the data science tooling is being built out for Swift you can use anything from the Python ecosystem (including np and pd) by using the Python interop:

let np = Python.import(“numpy”)

https://github.com/tensorflow/swift/blob/master/docs/PythonI...

1 comments

how does this work? does it actually compile/embed there python interpreter or does it make calls to the system interpreter somehow?
From the linked document:

> To accomplish this, the Swift script/program simply links the Python interpreter into its code.

I would imagine that having the interpreter in another process would be a gigantice performance hit.

yea i realized it's the obvious thing: load the dll.
i just tried this out and i'm blown away that it works. even matplotlib. does anyone know how to point it at a different interpreter? a venv for example?