fusion-engineering / inline-python

Inline Python code directly in your Rust code
https://docs.rs/inline-python
BSD 2-Clause "Simplified" License
1.15k stars 37 forks source link

ToPyObject vs IntoPyObject #10

Closed m-ou-se closed 3 years ago

m-ou-se commented 5 years ago

We should probably use IntoPyObject instead. Right now we're using ToPyObject, which will clone data. But we should first investigate if there are any downsides.

de-vri-es commented 5 years ago

Are there really many objects that can benefit from IntoPyObject? I imagine most things will need to copy their data anyway. It's also a waste to consume something from the rust scope if the data is still getting copied.