{"action":"created","issue":{"url":"https://api.github.com/repos/datajoint/datajoint-python/issues/136","repository_url":"https://api.github.com/repos/datajoint/datajoint-python","labels_url":"https://api.github.com/repos/datajoint/datajoint-python/issues/136/labels{/name}","comments_url":"https://api.github.com/repos/datajoint/datajoint-python/issues/136/comments","events_url":"https://api.github.com/repos/datajoint/datajoint-python/issues/136/events","html_url":"https://github.com/datajoint/datajoint-python/issues/136","id":97247671,"number":136,"title":"`__str__` and `__repr__` for RelationalOperand","user":{"login":"eywalker","id":3084661,"avatar_url":"https://avatars.githubusercontent.com/u/3084661?v=3","gravatar_id":"","url":"https://api.github.com/users/eywalker","html_url":"https://github.com/eywalker","followers_url":"https://api.github.com/users/eywalker/followers","following_url":"https://api.github.com/users/eywalker/following{/other_user}","gists_url":"https://api.github.com/users/eywalker/gists{/gist_id}","starred_url":"https://api.github.com/users/eywalker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eywalker/subscriptions","organizations_url":"https://api.github.com/users/eywalker/orgs","repos_url":"https://api.github.com/users/eywalker/repos","events_url":"https://api.github.com/users/eywalker/events{/privacy}","received_events_url":"https://api.github.com/users/eywalker/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/datajoint/datajoint-python/labels/features","name":"features","color":"009800"},{"url":"https://api.github.com/repos/datajoint/datajoint-python/labels/wontfix","name":"wontfix","color":"ffffff"}],"state":"closed","locked":false,"assignee":{"login":"eywalker","id":3084661,"avatar_url":"https://avatars.githubusercontent.com/u/3084661?v=3","gravatar_id":"","url":"https://api.github.com/users/eywalker","html_url":"https://github.com/eywalker","followers_url":"https://api.github.com/users/eywalker/followers","following_url":"https://api.github.com/users/eywalker/following{/other_user}","gists_url":"https://api.github.com/users/eywalker/gists{/gist_id}","starred_url":"https://api.github.com/users/eywalker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eywalker/subscriptions","organizations_url":"https://api.github.com/users/eywalker/orgs","repos_url":"https://api.github.com/users/eywalker/repos","events_url":"https://api.github.com/users/eywalker/events{/privacy}","received_events_url":"https://api.github.com/users/eywalker/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/datajoint/datajoint-python/milestones/1","html_url":"https://github.com/datajoint/datajoint-python/milestones/Release%20v0.1","labels_url":"https://api.github.com/repos/datajoint/datajoint-python/milestones/1/labels","id":1165040,"number":1,"title":"Release v0.1","description":"Beta release for datajoint python","creator":{"login":"eywalker","id":3084661,"avatar_url":"https://avatars.githubusercontent.com/u/3084661?v=3","gravatar_id":"","url":"https://api.github.com/users/eywalker","html_url":"https://github.com/eywalker","followers_url":"https://api.github.com/users/eywalker/followers","following_url":"https://api.github.com/users/eywalker/following{/other_user}","gists_url":"https://api.github.com/users/eywalker/gists{/gist_id}","starred_url":"https://api.github.com/users/eywalker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eywalker/subscriptions","organizations_url":"https://api.github.com/users/eywalker/orgs","repos_url":"https://api.github.com/users/eywalker/repos","events_url":"https://api.github.com/users/eywalker/events{/privacy}","received_events_url":"https://api.github.com/users/eywalker/received_events","type":"User","site_admin":false},"open_issues":5,"closed_issues":19,"state":"open","created_at":"2015-06-15T15:03:49Z","updated_at":"2016-06-15T17:02:17Z","due_on":"2015-07-31T05:00:00Z","closed_at":null},"comments":4,"created_at":"2015-07-25T19:10:28Z","updated_at":"2016-06-15T17:02:17Z","closed_at":"2016-06-15T17:02:17Z","body":"Currently the `__repr__` for `RelationalOperand` prints out the heading as well as the first few rows of the query. Although this is a very useful representation for a quick inspection of the table (or result of relational operations) content, it makes debugging quite annoying as quick inspection of the `RelationOperand` both executes the query and prints out often times massive table. As succinctly stated in Python's documentation on [`__repr__`](https://docs.python.org/3/reference/datamodel.html#object.__repr__), the `__repr__` is meant to be used during debugging, providing *unambiguous* information about the object (this concept is also well described [here](http://satran.in/2012/03/14/python-repr-str.html)).\r\n\r\nGiven this, I propose two alternatives:\r\n\r\n1. Move the current verbose string representation found in `__repr__` into `__str__`, and supply more succinct but useful-for-debugging string representation in `__repr__` (e.g. relational operation that yielded the current object). In fact, if `__repr__` can contain the full description of how it was produced, that'd be useful. If a user would want to see what the relation's content looks like, it can be viewed via `print(relation)`\r\n\r\n2. Since I understand that being able to just type in the name of relation at the interactive Python to get content preview is quite nice, we could add a config flag that controls the behavior of the `__repr__` . We would ship DataJoint with this config flag default to something like `preview`, causing `__repr__` to print out the preview of the table content as it does already. When debugging, the config flag can be set to `debug` with more succinct `__repr__` behavior.\r\n\r\nAlthough I think option 1  follows the mantra of Python language, packages like `pandas` use option 2, defaulting to verbose `__repr__` useful during interactive programming."},"comment":{"url":"https://api.github.com/repos/datajoint/datajoint-python/issues/comments/226252070","html_url":"https://github.com/datajoint/datajoint-python/issues/136#issuecomment-226252070","issue_url":"https://api.github.com/repos/datajoint/datajoint-python/issues/136","id":226252070,"user":{"login":"dimitri-yatsenko","id":1096169,"avatar_url":"https://avatars.githubusercontent.com/u/1096169?v=3","gravatar_id":"","url":"https://api.github.com/users/dimitri-yatsenko","html_url":"https://github.com/dimitri-yatsenko","followers_url":"https://api.github.com/users/dimitri-yatsenko/followers","following_url":"https://api.github.com/users/dimitri-yatsenko/following{/other_user}","gists_url":"https://api.github.com/users/dimitri-yatsenko/gists{/gist_id}","starred_url":"https://api.github.com/users/dimitri-yatsenko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dimitri-yatsenko/subscriptions","organizations_url":"https://api.github.com/users/dimitri-yatsenko/orgs","repos_url":"https://api.github.com/users/dimitri-yatsenko/repos","events_url":"https://api.github.com/users/dimitri-yatsenko/events{/privacy}","received_events_url":"https://api.github.com/users/dimitri-yatsenko/received_events","type":"User","site_admin":false},"created_at":"2016-06-15T17:02:17Z","updated_at":"2016-06-15T17:02:17Z","body":"Addressed in 4debbd88f"}}
{"actor":{"display_login":"dimitri-yatsenko"}}