{"action":"created","issue":{"url":"https://api.github.com/repos/numpy/numpy/issues/6748","labels_url":"https://api.github.com/repos/numpy/numpy/issues/6748/labels{/name}","comments_url":"https://api.github.com/repos/numpy/numpy/issues/6748/comments","events_url":"https://api.github.com/repos/numpy/numpy/issues/6748/events","html_url":"https://github.com/numpy/numpy/pull/6748","id":119443152,"number":6748,"title":"ENH: Avoid memory peak and useless computations when printing a MaskedArray.","user":{"login":"saimn","id":311639,"avatar_url":"https://avatars.githubusercontent.com/u/311639?v=3","gravatar_id":"","url":"https://api.github.com/users/saimn","html_url":"https://github.com/saimn","followers_url":"https://api.github.com/users/saimn/followers","following_url":"https://api.github.com/users/saimn/following{/other_user}","gists_url":"https://api.github.com/users/saimn/gists{/gist_id}","starred_url":"https://api.github.com/users/saimn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/saimn/subscriptions","organizations_url":"https://api.github.com/users/saimn/orgs","repos_url":"https://api.github.com/users/saimn/repos","events_url":"https://api.github.com/users/saimn/events{/privacy}","received_events_url":"https://api.github.com/users/saimn/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/numpy/numpy/labels/component:%20numpy.ma","name":"component: numpy.ma","color":"ff0000"},{"url":"https://api.github.com/repos/numpy/numpy/labels/Defect","name":"Defect","color":"444444"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2015-11-30T08:41:14Z","updated_at":"2015-12-01T22:55:21Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/numpy/numpy/pulls/6748","html_url":"https://github.com/numpy/numpy/pull/6748","diff_url":"https://github.com/numpy/numpy/pull/6748.diff","patch_url":"https://github.com/numpy/numpy/pull/6748.patch"},"body":"Ref #3544. When printing a `MaskedArray`, the whole array is converted to the object dtype, whereas only a few values are printed to screen. \r\nThe approach here is to cut the array along each axis and keep only a subset that it used for the string conversion. This way the output should not change. The shape used for the cut (100 values for each axis) was chosen so we have enough values when printing on large screen (and the number of printed values depend on the dtype if I understand correctly), maybe there is a better value to choose (inspired from what ndarray.__str__ does ?).\r\nMaybe there is a better approach, in which case I am happy to improve this PR."},"comment":{"url":"https://api.github.com/repos/numpy/numpy/issues/comments/161123417","html_url":"https://github.com/numpy/numpy/pull/6748#issuecomment-161123417","issue_url":"https://api.github.com/repos/numpy/numpy/issues/6748","id":161123417,"user":{"login":"charris","id":77272,"avatar_url":"https://avatars.githubusercontent.com/u/77272?v=3","gravatar_id":"","url":"https://api.github.com/users/charris","html_url":"https://github.com/charris","followers_url":"https://api.github.com/users/charris/followers","following_url":"https://api.github.com/users/charris/following{/other_user}","gists_url":"https://api.github.com/users/charris/gists{/gist_id}","starred_url":"https://api.github.com/users/charris/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/charris/subscriptions","organizations_url":"https://api.github.com/users/charris/orgs","repos_url":"https://api.github.com/users/charris/repos","events_url":"https://api.github.com/users/charris/events{/privacy}","received_events_url":"https://api.github.com/users/charris/received_events","type":"User","site_admin":false},"created_at":"2015-12-01T22:55:20Z","updated_at":"2015-12-01T22:55:20Z","body":"Comment looks fine, but there is another nit to pick."}}