{"action":"created","issue":{"url":"https://api.github.com/repos/KxSystems/embedPy/issues/44","repository_url":"https://api.github.com/repos/KxSystems/embedPy","labels_url":"https://api.github.com/repos/KxSystems/embedPy/issues/44/labels{/name}","comments_url":"https://api.github.com/repos/KxSystems/embedPy/issues/44/comments","events_url":"https://api.github.com/repos/KxSystems/embedPy/issues/44/events","html_url":"https://github.com/KxSystems/embedPy/issues/44","id":323788299,"node_id":"MDU6SXNzdWUzMjM3ODgyOTk=","number":44,"title":"Lists of objects aren't being unwrapped recursively?","user":{"login":"mcg1969","id":2797735,"node_id":"MDQ6VXNlcjI3OTc3MzU=","avatar_url":"https://avatars1.githubusercontent.com/u/2797735?v=4","gravatar_id":"","url":"https://api.github.com/users/mcg1969","html_url":"https://github.com/mcg1969","followers_url":"https://api.github.com/users/mcg1969/followers","following_url":"https://api.github.com/users/mcg1969/following{/other_user}","gists_url":"https://api.github.com/users/mcg1969/gists{/gist_id}","starred_url":"https://api.github.com/users/mcg1969/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mcg1969/subscriptions","organizations_url":"https://api.github.com/users/mcg1969/orgs","repos_url":"https://api.github.com/users/mcg1969/repos","events_url":"https://api.github.com/users/mcg1969/events{/privacy}","received_events_url":"https://api.github.com/users/mcg1969/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-05-16T21:11:11Z","updated_at":"2018-06-11T14:02:17Z","closed_at":null,"author_association":"NONE","body":"I was playing with some advanced IPython widget usage that requires passing in lists whose first element is a Python object. Unfortunately, while bare Python objects are automatically unwrapped on the way back to Python, that's not true of Python objects in a _list_. I did discover that you can force them to be unwrapped, but it seems better if the embedPy functionality would do this recursively on lists and other composite objects.\r\n```\r\np)class MyObject:\r\n    pass\r\np)def bar():\r\n    return MyObject()\r\np)def foo(x):\r\n    if isinstance(x, list):\r\n        print('[' + (', '.join(repr(y) for y in x)) + ']')\r\n    else:\r\n        print(repr(x))\r\nfoo:.p.get[`foo]\r\nbar:.p.get[`bar]\r\nfoo(bar[])\r\nfoo((bar[];1))\r\nfoo((bar[]`.;1))\r\nfoo(\"a\";1)\r\n```\r\nOutput:\r\n```\r\n<__main__.MyObject object at 0x1196b2f98>\r\n[<built-in method q) of PyCapsule object at 0x1155632d0>, 1]\r\n[<__main__.MyObject object at 0x1196b2f98>, 1]\r\n['a', 1]\r\n```\r\nWhat seems sensible is that the to have to use that back-tick notation, so that the second line behaves the way the third one does."},"comment":{"url":"https://api.github.com/repos/KxSystems/embedPy/issues/comments/396253979","html_url":"https://github.com/KxSystems/embedPy/issues/44#issuecomment-396253979","issue_url":"https://api.github.com/repos/KxSystems/embedPy/issues/44","id":396253979,"node_id":"MDEyOklzc3VlQ29tbWVudDM5NjI1Mzk3OQ==","user":{"login":"awilson-kx","id":33430980,"node_id":"MDQ6VXNlcjMzNDMwOTgw","avatar_url":"https://avatars0.githubusercontent.com/u/33430980?v=4","gravatar_id":"","url":"https://api.github.com/users/awilson-kx","html_url":"https://github.com/awilson-kx","followers_url":"https://api.github.com/users/awilson-kx/followers","following_url":"https://api.github.com/users/awilson-kx/following{/other_user}","gists_url":"https://api.github.com/users/awilson-kx/gists{/gist_id}","starred_url":"https://api.github.com/users/awilson-kx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/awilson-kx/subscriptions","organizations_url":"https://api.github.com/users/awilson-kx/orgs","repos_url":"https://api.github.com/users/awilson-kx/repos","events_url":"https://api.github.com/users/awilson-kx/events{/privacy}","received_events_url":"https://api.github.com/users/awilson-kx/received_events","type":"User","site_admin":false},"created_at":"2018-06-11T14:02:17Z","updated_at":"2018-06-11T14:02:17Z","author_association":"CONTRIBUTOR","body":"Hey Michael\r\n\r\nThis was a design/performance decision, as recursive type checking proved too expensive.\r\n\r\nWhen passing arguments using embedPy\r\n- A native q object will be converted as appropriate (int -> int, float-array -> float-array)\r\n- An embedPy object will be unwrapped (exposing the foreign Python object)\r\n\r\nUnwrapping of embedPy objects inside q 'containers' (lists, dictionaries, tables etc) will not take place by default.\r\nIn most cases, no conversion is even necessary (as the argument consists solely of q data) and the performance hit is too great."}}
{"actor":{"display_login":"awilson-kx"}}