{"action":"created","issue":{"url":"https://api.github.com/repos/astropy/astropy/issues/1783","repository_url":"https://api.github.com/repos/astropy/astropy","labels_url":"https://api.github.com/repos/astropy/astropy/issues/1783/labels{/name}","comments_url":"https://api.github.com/repos/astropy/astropy/issues/1783/comments","events_url":"https://api.github.com/repos/astropy/astropy/issues/1783/events","html_url":"https://github.com/astropy/astropy/issues/1783","id":22624443,"number":1783,"title":"astropy.table: should join, hstack, vstack be methods instead of functions?","user":{"login":"hamogu","id":498688,"avatar_url":"https://avatars.githubusercontent.com/u/498688?v=3","gravatar_id":"","url":"https://api.github.com/users/hamogu","html_url":"https://github.com/hamogu","followers_url":"https://api.github.com/users/hamogu/followers","following_url":"https://api.github.com/users/hamogu/following{/other_user}","gists_url":"https://api.github.com/users/hamogu/gists{/gist_id}","starred_url":"https://api.github.com/users/hamogu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hamogu/subscriptions","organizations_url":"https://api.github.com/users/hamogu/orgs","repos_url":"https://api.github.com/users/hamogu/repos","events_url":"https://api.github.com/users/hamogu/events{/privacy}","received_events_url":"https://api.github.com/users/hamogu/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/astropy/astropy/labels/table","name":"table","color":"c7def8"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/astropy/astropy/milestones/5","html_url":"https://github.com/astropy/astropy/milestones/Future","labels_url":"https://api.github.com/repos/astropy/astropy/milestones/5/labels","id":194018,"number":5,"title":"Future","description":"A feature or task for a future unspecified release.","creator":{"login":"embray","id":676149,"avatar_url":"https://avatars.githubusercontent.com/u/676149?v=3","gravatar_id":"","url":"https://api.github.com/users/embray","html_url":"https://github.com/embray","followers_url":"https://api.github.com/users/embray/followers","following_url":"https://api.github.com/users/embray/following{/other_user}","gists_url":"https://api.github.com/users/embray/gists{/gist_id}","starred_url":"https://api.github.com/users/embray/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/embray/subscriptions","organizations_url":"https://api.github.com/users/embray/orgs","repos_url":"https://api.github.com/users/embray/repos","events_url":"https://api.github.com/users/embray/events{/privacy}","received_events_url":"https://api.github.com/users/embray/received_events","type":"User","site_admin":false},"open_issues":107,"closed_issues":63,"state":"open","created_at":"2012-10-11T15:46:42Z","updated_at":"2016-03-23T22:25:13Z","due_on":null,"closed_at":null},"comments":5,"created_at":"2013-11-13T21:39:10Z","updated_at":"2016-04-03T12:41:17Z","closed_at":null,"body":"I use a custom class that is derived from `astropy.table`. This class has some custom attributes that need to be dealt with when I join tables.\r\nIn the sources code of `astropy.table.operations.join` it even says:\r\n```\r\n    # Merge the column and table meta data. Table subclasses might override\r\n    # these methods for custom merge behavior.\r\n    _merge_col_meta(out, [left, right], col_name_map, metadata_conflicts=metadata_conflicts)\r\n    _merge_table_meta(out, [left, right], metadata_conflicts=metadata_conflicts)\r\n```\r\nHowever, since `_merge_table_meta` is not a method of the table class, but instead a function defined on the `astropy.table.operations` level, how do I override this?\r\nAll I can think of is monkey-patching `astropy.table._merge_table_meta`, but then I would loose the ability to join anything that's not my specific table subclass.\r\n\r\nThus, I wonder if `join`, `hstack` and similar operations (or at least `_merge_col_meta` and `_merge_table_meta`) should be methods and not functions?\r\nThis would make for a call like this\r\n```\r\ntab1.join(tab2, join_type = ... )\r\n```\r\nI could then override the appropiate methods for my class of `tab1`, if I want."},"comment":{"url":"https://api.github.com/repos/astropy/astropy/issues/comments/204963166","html_url":"https://github.com/astropy/astropy/issues/1783#issuecomment-204963166","issue_url":"https://api.github.com/repos/astropy/astropy/issues/1783","id":204963166,"user":{"login":"taldcroft","id":348089,"avatar_url":"https://avatars.githubusercontent.com/u/348089?v=3","gravatar_id":"","url":"https://api.github.com/users/taldcroft","html_url":"https://github.com/taldcroft","followers_url":"https://api.github.com/users/taldcroft/followers","following_url":"https://api.github.com/users/taldcroft/following{/other_user}","gists_url":"https://api.github.com/users/taldcroft/gists{/gist_id}","starred_url":"https://api.github.com/users/taldcroft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/taldcroft/subscriptions","organizations_url":"https://api.github.com/users/taldcroft/orgs","repos_url":"https://api.github.com/users/taldcroft/repos","events_url":"https://api.github.com/users/taldcroft/events{/privacy}","received_events_url":"https://api.github.com/users/taldcroft/received_events","type":"User","site_admin":false},"created_at":"2016-04-03T12:41:17Z","updated_at":"2016-04-03T12:41:17Z","body":"I've been thinking about this recently and would propose making these available as class methods, e.g. `Table.hstack([t1, t2])` etc.  This would allow things like `QTable.hstack('[t1, t2]')` and indeed the original problem of `MyTable.hstack(..)`.  The functional forms could be (very) slowly deprecated, or just phased out from common usage by means of taking them out of the narrative docs.\r\n\r\nIn using table operations I've been annoyed by having to either import the `table` module explicitly for `table.hstack` or `from astropy.table import hstack`."}}