{"action":"created","comment":{"url":"https://api.github.com/repos/matplotlib/matplotlib/pulls/comments/25125584","id":25125584,"diff_hunk":"@@ -1523,6 +1523,23 @@ def set_ticklabels(self, ticklabels, *args, **kwargs):\n \n         ACCEPTS: sequence of strings\n         \"\"\"\n+\n+        #######################################################################\n+        # check whether the input is return value of get_ticklabels()\n+        # get_ticklabels() return a cbook.silent_list of Text objects  \n+        if isinstance(ticklabels, cbook.silent_list):","path":"lib/matplotlib/axis.py","position":8,"original_position":8,"commit_id":"729613a8ccf84d89a49f092b12e10dd7fffb7001","original_commit_id":"729613a8ccf84d89a49f092b12e10dd7fffb7001","user":{"login":"tacaswell","id":199813,"avatar_url":"https://avatars.githubusercontent.com/u/199813?v=3","gravatar_id":"","url":"https://api.github.com/users/tacaswell","html_url":"https://github.com/tacaswell","followers_url":"https://api.github.com/users/tacaswell/followers","following_url":"https://api.github.com/users/tacaswell/following{/other_user}","gists_url":"https://api.github.com/users/tacaswell/gists{/gist_id}","starred_url":"https://api.github.com/users/tacaswell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tacaswell/subscriptions","organizations_url":"https://api.github.com/users/tacaswell/orgs","repos_url":"https://api.github.com/users/tacaswell/repos","events_url":"https://api.github.com/users/tacaswell/events{/privacy}","received_events_url":"https://api.github.com/users/tacaswell/received_events","type":"User","site_admin":false},"body":"An anti-pattern is a pattern that shows up frequently in code that tends to indicate that you are doing things the hard way or in some way that is cutting against the grain of the library.   In this case, python is duck-typed (meaning that _anything_ that has the required attributes/functions can be passed in).  Explicitly checking types and changing code path based on that can produce brittle code.  For example if a user does some processing on the list returned from `get_ticklabels`, ends up with a list and then passes that list into `set_ticklabels`.  I think the list would fail this test and they would get the old behavior instead of your (correct) behavior.","created_at":"2015-02-21T20:43:19Z","updated_at":"2015-02-21T20:43:19Z","html_url":"https://github.com/matplotlib/matplotlib/pull/4141#discussion_r25125584","pull_request_url":"https://api.github.com/repos/matplotlib/matplotlib/pulls/4141","_links":{"self":{"href":"https://api.github.com/repos/matplotlib/matplotlib/pulls/comments/25125584"},"html":{"href":"https://github.com/matplotlib/matplotlib/pull/4141#discussion_r25125584"},"pull_request":{"href":"https://api.github.com/repos/matplotlib/matplotlib/pulls/4141"}}},"pull_request":{"url":"https://api.github.com/repos/matplotlib/matplotlib/pulls/4141","id":29759133,"html_url":"https://github.com/matplotlib/matplotlib/pull/4141","diff_url":"https://github.com/matplotlib/matplotlib/pull/4141.diff","patch_url":"https://github.com/matplotlib/matplotlib/pull/4141.patch","issue_url":"https://api.github.com/repos/matplotlib/matplotlib/issues/4141","number":4141,"state":"open","locked":false,"title":"Modify set_ticklabels() to fix counterintuitive behavior of set_ticklabels(get_ticklabels)#2246","user":{"login":"MirandaXM","id":8786301,"avatar_url":"https://avatars.githubusercontent.com/u/8786301?v=3","gravatar_id":"","url":"https://api.github.com/users/MirandaXM","html_url":"https://github.com/MirandaXM","followers_url":"https://api.github.com/users/MirandaXM/followers","following_url":"https://api.github.com/users/MirandaXM/following{/other_user}","gists_url":"https://api.github.com/users/MirandaXM/gists{/gist_id}","starred_url":"https://api.github.com/users/MirandaXM/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MirandaXM/subscriptions","organizations_url":"https://api.github.com/users/MirandaXM/orgs","repos_url":"https://api.github.com/users/MirandaXM/repos","events_url":"https://api.github.com/users/MirandaXM/events{/privacy}","received_events_url":"https://api.github.com/users/MirandaXM/received_events","type":"User","site_admin":false},"body":"Dear all,\r\n\r\nI made some changes to set_ticklabels() to solve counterintuitive behavior of set_ticklabels(get_ticklabels) #2246.\r\nHope it helps, thank you~~ ","created_at":"2015-02-21T20:09:46Z","updated_at":"2015-02-21T20:43:19Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b3da814eedc4d7f8c704c2261778131d5ff1b94a","assignee":null,"milestone":{"url":"https://api.github.com/repos/matplotlib/matplotlib/milestones/18","labels_url":"https://api.github.com/repos/matplotlib/matplotlib/milestones/18/labels","id":970105,"number":18,"title":"next point release","description":"Next minor release.","creator":{"login":"tacaswell","id":199813,"avatar_url":"https://avatars.githubusercontent.com/u/199813?v=3","gravatar_id":"","url":"https://api.github.com/users/tacaswell","html_url":"https://github.com/tacaswell","followers_url":"https://api.github.com/users/tacaswell/followers","following_url":"https://api.github.com/users/tacaswell/following{/other_user}","gists_url":"https://api.github.com/users/tacaswell/gists{/gist_id}","starred_url":"https://api.github.com/users/tacaswell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tacaswell/subscriptions","organizations_url":"https://api.github.com/users/tacaswell/orgs","repos_url":"https://api.github.com/users/tacaswell/repos","events_url":"https://api.github.com/users/tacaswell/events{/privacy}","received_events_url":"https://api.github.com/users/tacaswell/received_events","type":"User","site_admin":false},"open_issues":159,"closed_issues":28,"state":"open","created_at":"2015-02-07T21:22:30Z","updated_at":"2015-02-21T20:18:09Z","due_on":"2015-07-06T04:00:00Z","closed_at":null},"commits_url":"https://api.github.com/repos/matplotlib/matplotlib/pulls/4141/commits","review_comments_url":"https://api.github.com/repos/matplotlib/matplotlib/pulls/4141/comments","review_comment_url":"https://api.github.com/repos/matplotlib/matplotlib/pulls/comments/{number}","comments_url":"https://api.github.com/repos/matplotlib/matplotlib/issues/4141/comments","statuses_url":"https://api.github.com/repos/matplotlib/matplotlib/statuses/729613a8ccf84d89a49f092b12e10dd7fffb7001","head":{"label":"MirandaXM:2246","ref":"2246","sha":"729613a8ccf84d89a49f092b12e10dd7fffb7001","user":{"login":"MirandaXM","id":8786301,"avatar_url":"https://avatars.githubusercontent.com/u/8786301?v=3","gravatar_id":"","url":"https://api.github.com/users/MirandaXM","html_url":"https://github.com/MirandaXM","followers_url":"https://api.github.com/users/MirandaXM/followers","following_url":"https://api.github.com/users/MirandaXM/following{/other_user}","gists_url":"https://api.github.com/users/MirandaXM/gists{/gist_id}","starred_url":"https://api.github.com/users/MirandaXM/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MirandaXM/subscriptions","organizations_url":"https://api.github.com/users/MirandaXM/orgs","repos_url":"https://api.github.com/users/MirandaXM/repos","events_url":"https://api.github.com/users/MirandaXM/events{/privacy}","received_events_url":"https://api.github.com/users/MirandaXM/received_events","type":"User","site_admin":false},"repo":{"id":31134649,"name":"matplotlib","full_name":"MirandaXM/matplotlib","owner":{"login":"MirandaXM","id":8786301,"avatar_url":"https://avatars.githubusercontent.com/u/8786301?v=3","gravatar_id":"","url":"https://api.github.com/users/MirandaXM","html_url":"https://github.com/MirandaXM","followers_url":"https://api.github.com/users/MirandaXM/followers","following_url":"https://api.github.com/users/MirandaXM/following{/other_user}","gists_url":"https://api.github.com/users/MirandaXM/gists{/gist_id}","starred_url":"https://api.github.com/users/MirandaXM/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MirandaXM/subscriptions","organizations_url":"https://api.github.com/users/MirandaXM/orgs","repos_url":"https://api.github.com/users/MirandaXM/repos","events_url":"https://api.github.com/users/MirandaXM/events{/privacy}","received_events_url":"https://api.github.com/users/MirandaXM/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/MirandaXM/matplotlib","description":"matplotlib: plotting with Python","fork":true,"url":"https://api.github.com/repos/MirandaXM/matplotlib","forks_url":"https://api.github.com/repos/MirandaXM/matplotlib/forks","keys_url":"https://api.github.com/repos/MirandaXM/matplotlib/keys{/key_id}","collaborators_url":"https://api.github.com/repos/MirandaXM/matplotlib/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/MirandaXM/matplotlib/teams","hooks_url":"https://api.github.com/repos/MirandaXM/matplotlib/hooks","issue_events_url":"https://api.github.com/repos/MirandaXM/matplotlib/issues/events{/number}","events_url":"https://api.github.com/repos/MirandaXM/matplotlib/events","assignees_url":"https://api.github.com/repos/MirandaXM/matplotlib/assignees{/user}","branches_url":"https://api.github.com/repos/MirandaXM/matplotlib/branches{/branch}","tags_url":"https://api.github.com/repos/MirandaXM/matplotlib/tags","blobs_url":"https://api.github.com/repos/MirandaXM/matplotlib/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/MirandaXM/matplotlib/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/MirandaXM/matplotlib/git/refs{/sha}","trees_url":"https://api.github.com/repos/MirandaXM/matplotlib/git/trees{/sha}","statuses_url":"https://api.github.com/repos/MirandaXM/matplotlib/statuses/{sha}","languages_url":"https://api.github.com/repos/MirandaXM/matplotlib/languages","stargazers_url":"https://api.github.com/repos/MirandaXM/matplotlib/stargazers","contributors_url":"https://api.github.com/repos/MirandaXM/matplotlib/contributors","subscribers_url":"https://api.github.com/repos/MirandaXM/matplotlib/subscribers","subscription_url":"https://api.github.com/repos/MirandaXM/matplotlib/subscription","commits_url":"https://api.github.com/repos/MirandaXM/matplotlib/commits{/sha}","git_commits_url":"https://api.github.com/repos/MirandaXM/matplotlib/git/commits{/sha}","comments_url":"https://api.github.com/repos/MirandaXM/matplotlib/comments{/number}","issue_comment_url":"https://api.github.com/repos/MirandaXM/matplotlib/issues/comments/{number}","contents_url":"https://api.github.com/repos/MirandaXM/matplotlib/contents/{+path}","compare_url":"https://api.github.com/repos/MirandaXM/matplotlib/compare/{base}...{head}","merges_url":"https://api.github.com/repos/MirandaXM/matplotlib/merges","archive_url":"https://api.github.com/repos/MirandaXM/matplotlib/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/MirandaXM/matplotlib/downloads","issues_url":"https://api.github.com/repos/MirandaXM/matplotlib/issues{/number}","pulls_url":"https://api.github.com/repos/MirandaXM/matplotlib/pulls{/number}","milestones_url":"https://api.github.com/repos/MirandaXM/matplotlib/milestones{/number}","notifications_url":"https://api.github.com/repos/MirandaXM/matplotlib/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/MirandaXM/matplotlib/labels{/name}","releases_url":"https://api.github.com/repos/MirandaXM/matplotlib/releases{/id}","created_at":"2015-02-21T17:59:12Z","updated_at":"2015-02-21T17:59:20Z","pushed_at":"2015-02-21T20:03:07Z","git_url":"git://github.com/MirandaXM/matplotlib.git","ssh_url":"git@github.com:MirandaXM/matplotlib.git","clone_url":"https://github.com/MirandaXM/matplotlib.git","svn_url":"https://github.com/MirandaXM/matplotlib","homepage":"http://matplotlib.org/","size":258230,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"matplotlib:master","ref":"master","sha":"1fe5b9c95d362a3902e5de532f86abd2accc8b6d","user":{"login":"matplotlib","id":215947,"avatar_url":"https://avatars.githubusercontent.com/u/215947?v=3","gravatar_id":"","url":"https://api.github.com/users/matplotlib","html_url":"https://github.com/matplotlib","followers_url":"https://api.github.com/users/matplotlib/followers","following_url":"https://api.github.com/users/matplotlib/following{/other_user}","gists_url":"https://api.github.com/users/matplotlib/gists{/gist_id}","starred_url":"https://api.github.com/users/matplotlib/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/matplotlib/subscriptions","organizations_url":"https://api.github.com/users/matplotlib/orgs","repos_url":"https://api.github.com/users/matplotlib/repos","events_url":"https://api.github.com/users/matplotlib/events{/privacy}","received_events_url":"https://api.github.com/users/matplotlib/received_events","type":"Organization","site_admin":false},"repo":{"id":1385122,"name":"matplotlib","full_name":"matplotlib/matplotlib","owner":{"login":"matplotlib","id":215947,"avatar_url":"https://avatars.githubusercontent.com/u/215947?v=3","gravatar_id":"","url":"https://api.github.com/users/matplotlib","html_url":"https://github.com/matplotlib","followers_url":"https://api.github.com/users/matplotlib/followers","following_url":"https://api.github.com/users/matplotlib/following{/other_user}","gists_url":"https://api.github.com/users/matplotlib/gists{/gist_id}","starred_url":"https://api.github.com/users/matplotlib/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/matplotlib/subscriptions","organizations_url":"https://api.github.com/users/matplotlib/orgs","repos_url":"https://api.github.com/users/matplotlib/repos","events_url":"https://api.github.com/users/matplotlib/events{/privacy}","received_events_url":"https://api.github.com/users/matplotlib/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/matplotlib/matplotlib","description":"matplotlib: plotting with Python","fork":false,"url":"https://api.github.com/repos/matplotlib/matplotlib","forks_url":"https://api.github.com/repos/matplotlib/matplotlib/forks","keys_url":"https://api.github.com/repos/matplotlib/matplotlib/keys{/key_id}","collaborators_url":"https://api.github.com/repos/matplotlib/matplotlib/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/matplotlib/matplotlib/teams","hooks_url":"https://api.github.com/repos/matplotlib/matplotlib/hooks","issue_events_url":"https://api.github.com/repos/matplotlib/matplotlib/issues/events{/number}","events_url":"https://api.github.com/repos/matplotlib/matplotlib/events","assignees_url":"https://api.github.com/repos/matplotlib/matplotlib/assignees{/user}","branches_url":"https://api.github.com/repos/matplotlib/matplotlib/branches{/branch}","tags_url":"https://api.github.com/repos/matplotlib/matplotlib/tags","blobs_url":"https://api.github.com/repos/matplotlib/matplotlib/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/matplotlib/matplotlib/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/matplotlib/matplotlib/git/refs{/sha}","trees_url":"https://api.github.com/repos/matplotlib/matplotlib/git/trees{/sha}","statuses_url":"https://api.github.com/repos/matplotlib/matplotlib/statuses/{sha}","languages_url":"https://api.github.com/repos/matplotlib/matplotlib/languages","stargazers_url":"https://api.github.com/repos/matplotlib/matplotlib/stargazers","contributors_url":"https://api.github.com/repos/matplotlib/matplotlib/contributors","subscribers_url":"https://api.github.com/repos/matplotlib/matplotlib/subscribers","subscription_url":"https://api.github.com/repos/matplotlib/matplotlib/subscription","commits_url":"https://api.github.com/repos/matplotlib/matplotlib/commits{/sha}","git_commits_url":"https://api.github.com/repos/matplotlib/matplotlib/git/commits{/sha}","comments_url":"https://api.github.com/repos/matplotlib/matplotlib/comments{/number}","issue_comment_url":"https://api.github.com/repos/matplotlib/matplotlib/issues/comments/{number}","contents_url":"https://api.github.com/repos/matplotlib/matplotlib/contents/{+path}","compare_url":"https://api.github.com/repos/matplotlib/matplotlib/compare/{base}...{head}","merges_url":"https://api.github.com/repos/matplotlib/matplotlib/merges","archive_url":"https://api.github.com/repos/matplotlib/matplotlib/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/matplotlib/matplotlib/downloads","issues_url":"https://api.github.com/repos/matplotlib/matplotlib/issues{/number}","pulls_url":"https://api.github.com/repos/matplotlib/matplotlib/pulls{/number}","milestones_url":"https://api.github.com/repos/matplotlib/matplotlib/milestones{/number}","notifications_url":"https://api.github.com/repos/matplotlib/matplotlib/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/matplotlib/matplotlib/labels{/name}","releases_url":"https://api.github.com/repos/matplotlib/matplotlib/releases{/id}","created_at":"2011-02-19T03:17:12Z","updated_at":"2015-02-21T16:55:29Z","pushed_at":"2015-02-19T03:57:24Z","git_url":"git://github.com/matplotlib/matplotlib.git","ssh_url":"git@github.com:matplotlib/matplotlib.git","clone_url":"https://github.com/matplotlib/matplotlib.git","svn_url":"https://github.com/matplotlib/matplotlib","homepage":"http://matplotlib.org/","size":258230,"stargazers_count":2272,"watchers_count":2272,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1130,"mirror_url":null,"open_issues_count":455,"forks":1130,"open_issues":455,"watchers":2272,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/matplotlib/matplotlib/pulls/4141"},"html":{"href":"https://github.com/matplotlib/matplotlib/pull/4141"},"issue":{"href":"https://api.github.com/repos/matplotlib/matplotlib/issues/4141"},"comments":{"href":"https://api.github.com/repos/matplotlib/matplotlib/issues/4141/comments"},"review_comments":{"href":"https://api.github.com/repos/matplotlib/matplotlib/pulls/4141/comments"},"review_comment":{"href":"https://api.github.com/repos/matplotlib/matplotlib/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/matplotlib/matplotlib/pulls/4141/commits"},"statuses":{"href":"https://api.github.com/repos/matplotlib/matplotlib/statuses/729613a8ccf84d89a49f092b12e10dd7fffb7001"}}}}