Skip to content
This repository has been archived by the owner on Jan 11, 2022. It is now read-only.

No way to create slice objects #25

Open
halostatue opened this issue Jun 21, 2017 · 3 comments
Open

No way to create slice objects #25

halostatue opened this issue Jun 21, 2017 · 3 comments

Comments

@halostatue
Copy link
Collaborator

I tried to slice a numpy array but this doesn't work since Ruby doesn't understand Python's slice syntax. If I could create a slice object using the Python built-in slice function, I could get around this by passing a slice object to Numpy's getslice method, but afaik there's no way to access this.

Perhaps RubyPython could provide a built-in for this? Access to other Python built-ins would be nice as well, though less necessary. Specifically, access to len and type would be handy.

@lokeshh
Copy link

lokeshh commented Feb 18, 2018

Yes this would be very useful. I'm able to run the majority of numpy except indexing because of this issue.

@lokeshh
Copy link

lokeshh commented Feb 18, 2018

One way I can think it might work is by import the function slice from python somehow. Any idea how to do it?

@lokeshh
Copy link

lokeshh commented Feb 18, 2018

I managed to create one. Here's how:

RubyPython::PyMainClass.send(:new).slice(2, 3)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants