{"action":"created","issue":{"url":"https://api.github.com/repos/stevengj/PyCall.jl/issues/142","labels_url":"https://api.github.com/repos/stevengj/PyCall.jl/issues/142/labels{/name}","comments_url":"https://api.github.com/repos/stevengj/PyCall.jl/issues/142/comments","events_url":"https://api.github.com/repos/stevengj/PyCall.jl/issues/142/events","html_url":"https://github.com/stevengj/PyCall.jl/issues/142","id":76475108,"number":142,"title":"keep python nested list/array structure","user":{"login":"kubaroth","id":8253037,"avatar_url":"https://avatars.githubusercontent.com/u/8253037?v=3","gravatar_id":"","url":"https://api.github.com/users/kubaroth","html_url":"https://github.com/kubaroth","followers_url":"https://api.github.com/users/kubaroth/followers","following_url":"https://api.github.com/users/kubaroth/following{/other_user}","gists_url":"https://api.github.com/users/kubaroth/gists{/gist_id}","starred_url":"https://api.github.com/users/kubaroth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kubaroth/subscriptions","organizations_url":"https://api.github.com/users/kubaroth/orgs","repos_url":"https://api.github.com/users/kubaroth/repos","events_url":"https://api.github.com/users/kubaroth/events{/privacy}","received_events_url":"https://api.github.com/users/kubaroth/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-05-14T20:12:03Z","updated_at":"2015-05-15T09:36:10Z","closed_at":null,"body":"I was wondering is there any way to retain structure of python nested lists.\r\n\r\nIn Python - a nested list/array is defined:\r\ne = [[1,2,3],[9,8,[3,2,1]]]\r\n\r\n\r\nThe standard PyCall import output in Julia looks like this:\r\n2x3 Array{Any,2}:\r\n 1  2  3          \r\n 9  8   Any[3,2,1]\r\n\r\nOften conversion to multidimensional arrays is very convenient but sometimes I need a bit more explicit control, especially when I want to keep things in order. I'm looking basically for a 1:1 representation:\r\n\r\n[1,2,3],[9,8,Any[3,2,1]]\r\n\r\n\r\nIs there any way I can instruct Julia/PyCall not to do the conversion into multidimensional arrays?\r\nSo far I can prevent it by sticking to pyobject type, but then I'm not sure what is the right PyCall's conversion function.\r\n\r\n@pyimport mymodule\r\nc = []          # which initilalzes 1-dim Array\r\nPyCall.py2array(c,mymodule.pymember(\"e\"))\r\n\r\nThanks"},"comment":{"url":"https://api.github.com/repos/stevengj/PyCall.jl/issues/comments/102343565","html_url":"https://github.com/stevengj/PyCall.jl/issues/142#issuecomment-102343565","issue_url":"https://api.github.com/repos/stevengj/PyCall.jl/issues/142","id":102343565,"user":{"login":"kubaroth","id":8253037,"avatar_url":"https://avatars.githubusercontent.com/u/8253037?v=3","gravatar_id":"","url":"https://api.github.com/users/kubaroth","html_url":"https://github.com/kubaroth","followers_url":"https://api.github.com/users/kubaroth/followers","following_url":"https://api.github.com/users/kubaroth/following{/other_user}","gists_url":"https://api.github.com/users/kubaroth/gists{/gist_id}","starred_url":"https://api.github.com/users/kubaroth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kubaroth/subscriptions","organizations_url":"https://api.github.com/users/kubaroth/orgs","repos_url":"https://api.github.com/users/kubaroth/repos","events_url":"https://api.github.com/users/kubaroth/events{/privacy}","received_events_url":"https://api.github.com/users/kubaroth/received_events","type":"User","site_admin":false},"created_at":"2015-05-15T09:36:10Z","updated_at":"2015-05-15T09:36:10Z","body":"Ok, so modifying the function did the trick. I had to return (1,) though instead of len.\r\n\r\n```julia\r\nfunction pyarray_dims(o::PyObject, forcelist=true)\r\n    if !(forcelist || pyisinstance(o, @pysym :PyList_Type))\r\n        return () # too many non-List types can pretend to be sequences\r\n    end\r\n    len = ccall((@pysym :PySequence_Size), Int, (PyPtr,), o)\r\n    return (1,)\r\nend\r\n```\r\nDo you think if makes sense to have a global variable/constant to override this behaviour? Or is it better just to leave it as is for now until PyBuffer will be supported?"}}