{"action":"created","issue":{"url":"https://api.github.com/repos/ipython/ipython/issues/8079","labels_url":"https://api.github.com/repos/ipython/ipython/issues/8079/labels{/name}","comments_url":"https://api.github.com/repos/ipython/ipython/issues/8079/comments","events_url":"https://api.github.com/repos/ipython/ipython/issues/8079/events","html_url":"https://github.com/ipython/ipython/pull/8079","id":62782640,"number":8079,"title":"Autocompletion & docstrings for MATLAB interface.","user":{"login":"anntzer","id":1322974,"avatar_url":"https://avatars.githubusercontent.com/u/1322974?v=3","gravatar_id":"","url":"https://api.github.com/users/anntzer","html_url":"https://github.com/anntzer","followers_url":"https://api.github.com/users/anntzer/followers","following_url":"https://api.github.com/users/anntzer/following{/other_user}","gists_url":"https://api.github.com/users/anntzer/gists{/gist_id}","starred_url":"https://api.github.com/users/anntzer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/anntzer/subscriptions","organizations_url":"https://api.github.com/users/anntzer/orgs","repos_url":"https://api.github.com/users/anntzer/repos","events_url":"https://api.github.com/users/anntzer/events{/privacy}","received_events_url":"https://api.github.com/users/anntzer/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/ipython/ipython/milestones/11","html_url":"https://github.com/ipython/ipython/milestones/no%20action","labels_url":"https://api.github.com/repos/ipython/ipython/milestones/11/labels","id":247447,"number":11,"title":"no action","description":"A milestone for closed or open issues for which there is no action needed.\r\n\r\n- duplicate\r\n- not a bug\r\n- just a question / discussion, nothing to resolve\r\n- wontfix\r\n- etc.","creator":{"login":"minrk","id":151929,"avatar_url":"https://avatars.githubusercontent.com/u/151929?v=3","gravatar_id":"","url":"https://api.github.com/users/minrk","html_url":"https://github.com/minrk","followers_url":"https://api.github.com/users/minrk/followers","following_url":"https://api.github.com/users/minrk/following{/other_user}","gists_url":"https://api.github.com/users/minrk/gists{/gist_id}","starred_url":"https://api.github.com/users/minrk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/minrk/subscriptions","organizations_url":"https://api.github.com/users/minrk/orgs","repos_url":"https://api.github.com/users/minrk/repos","events_url":"https://api.github.com/users/minrk/events{/privacy}","received_events_url":"https://api.github.com/users/minrk/received_events","type":"User","site_admin":false},"open_issues":16,"closed_issues":1721,"state":"open","created_at":"2013-01-19T01:33:01Z","updated_at":"2015-03-18T21:29:03Z","due_on":null,"closed_at":null},"comments":11,"created_at":"2015-03-18T19:46:55Z","updated_at":"2015-03-19T19:32:52Z","closed_at":"2015-03-18T21:29:01Z","pull_request":{"url":"https://api.github.com/repos/ipython/ipython/pulls/8079","html_url":"https://github.com/ipython/ipython/pull/8079","diff_url":"https://github.com/ipython/ipython/pull/8079.diff","patch_url":"https://github.com/ipython/ipython/pull/8079.patch"},"body":"For the Mathworks' official MATLAB engine for Python (which allows calling a MATLAB subprocess from Python), provide autocompletion of function names by manually walking the MATLAB search path; also provide docstrings for functions by calling MATLAB's builtin \"help\" function."},"comment":{"url":"https://api.github.com/repos/ipython/ipython/issues/comments/83732718","html_url":"https://github.com/ipython/ipython/pull/8079#issuecomment-83732718","issue_url":"https://api.github.com/repos/ipython/ipython/issues/8079","id":83732718,"user":{"login":"anntzer","id":1322974,"avatar_url":"https://avatars.githubusercontent.com/u/1322974?v=3","gravatar_id":"","url":"https://api.github.com/users/anntzer","html_url":"https://github.com/anntzer","followers_url":"https://api.github.com/users/anntzer/followers","following_url":"https://api.github.com/users/anntzer/following{/other_user}","gists_url":"https://api.github.com/users/anntzer/gists{/gist_id}","starred_url":"https://api.github.com/users/anntzer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/anntzer/subscriptions","organizations_url":"https://api.github.com/users/anntzer/orgs","repos_url":"https://api.github.com/users/anntzer/repos","events_url":"https://api.github.com/users/anntzer/events{/privacy}","received_events_url":"https://api.github.com/users/anntzer/received_events","type":"User","site_admin":false},"created_at":"2015-03-19T19:32:52Z","updated_at":"2015-03-19T19:32:52Z","body":"You can do this with a not-so-complicated descriptor:\r\n\r\n```\r\nclass instanceprop:\r\n    def __init__(self, classval, getinstanceval):\r\n        self._classval = classval\r\n        self._getinstanceval = getinstanceval\r\n\r\n    def __get__(self, instance, owner):\r\n        return self._classval if instance is None else self._getinstanceval(instance)\r\n\r\n\r\nclass C:\r\n    __doc__ = instanceprop(\"class doc\", lambda self: \"instance doc\")\r\n```\r\n\r\nThen\r\n```\r\nIn [2]: c = C()\r\n\r\nIn [3]: c?\r\nType:            C\r\nString form:     <instanceprop.C object at 0x7fd4a5cb8a20>\r\nFile:            /home/antony/tests/instanceprop.py\r\nDocstring:       instance doc\r\nClass docstring: class doc\r\n```\r\n\r\nBecause `__doc__` is set in the locals before the rest of the class definition is executed you could even write the proper decorator so that you can use a normal-looking docstring in the source (left as an exercise to the reader, you need some stack-walking :-))."}}