JuliaPy / JuliaPy/PyCall.jl

indexing using pycall get differs from python

Open
#234 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Julia
Stars
1.5k
Forks
186
PR merge metrics
No merged PRs in 30d

Description

I have read this:

Given o::PyObject, get(o, key) is equivalent to o[key] in Python, with automatic type conversion. To get as a PyObject without type conversion, do get(o, PyObject, key), or more generally get(o, SomeType, key). You can also supply a default value to use if the key is not found by get(o, key, default) or get(o, SomeType, key, default)

With this I successfully sliced a Python object ndarray in the first direction using:
image = get(image, PyObject, 5:70)
The problem is that I want to be able to do (in python) img[5:70, 5:200], use multiple arguments in brackets, but when typing
image = get(image, PyObject, 5:70, 5:200)
the second argument in seen as the default argument. So wouldn't it be nice to be able to give multiple arguments using get?

image = get(image, PyObject, (5:70, 5:200)) results in

LoadError: Only two or three spatial dimensions are permitted
while loading In[55], in expression starting on line 102
in call at /home/frank/.julia/v0.4/ImageView/src/display.jl:143
in view at /home/frank/.julia/v0.4/ImageView/src/display.jl:239
in obtainDataFromImages at In[55]:88
[inlined code] from In[55]:108
in anonymous at no file:0

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.