Issue #22 new

No way to create slice objects

Dan Sandberg
created an issue

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.

Comments (3)

  1. Dan Sandberg reporter

    You can accomplish what I wanted by writing a python module such as the one below.

    I suggest updating the rubypython intro to suggest this. If a module with all the built-ins can come standard (or maybe it already does?) even better. Thanks!

    --- python module ---

    import builtin

    def slice(a=None,b=None,c=None): return builtin.slice(a,b,c)

  2. Log in to comment