{"action":"created","comment":{"url":"https://api.github.com/repos/scrapy/scrapy/pulls/comments/38691217","id":38691217,"diff_hunk":"@@ -254,25 +254,22 @@ def get_spec(func):\n def equal_attributes(obj1, obj2, attributes):\n     \"\"\"Compare two objects attributes\"\"\"\n     # not attributes given return False by default\n-    if not attributes:\n-        return False","path":"scrapy/utils/python.py","position":5,"original_position":5,"commit_id":"6c8176aecd98d76fe3bf51a50b0fcb746a006607","original_commit_id":"6c8176aecd98d76fe3bf51a50b0fcb746a006607","user":{"login":"kmike","id":107893,"avatar_url":"https://avatars.githubusercontent.com/u/107893?v=3","gravatar_id":"","url":"https://api.github.com/users/kmike","html_url":"https://github.com/kmike","followers_url":"https://api.github.com/users/kmike/followers","following_url":"https://api.github.com/users/kmike/following{/other_user}","gists_url":"https://api.github.com/users/kmike/gists{/gist_id}","starred_url":"https://api.github.com/users/kmike/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kmike/subscriptions","organizations_url":"https://api.github.com/users/kmike/orgs","repos_url":"https://api.github.com/users/kmike/repos","events_url":"https://api.github.com/users/kmike/events{/privacy}","received_events_url":"https://api.github.com/users/kmike/received_events","type":"User","site_admin":false},"body":"This is a common style to write functions: first we check special cases, and then we write the main function body. It allows to remove unnecessary nesting and makes code easier to read to people familiar with this convention. I.e. in existing implementation it reads like the main thing function is doing is checking each attribute (`for attr in attributes:`); in your version this loop is in an indented block after some statements. It may be a personal preference, but I like the existing way to write it more.","created_at":"2015-09-03T20:15:41Z","updated_at":"2015-09-03T20:15:41Z","html_url":"https://github.com/scrapy/scrapy/pull/1477#discussion_r38691217","pull_request_url":"https://api.github.com/repos/scrapy/scrapy/pulls/1477","_links":{"self":{"href":"https://api.github.com/repos/scrapy/scrapy/pulls/comments/38691217"},"html":{"href":"https://github.com/scrapy/scrapy/pull/1477#discussion_r38691217"},"pull_request":{"href":"https://api.github.com/repos/scrapy/scrapy/pulls/1477"}}},"pull_request":{"url":"https://api.github.com/repos/scrapy/scrapy/pulls/1477","id":44149727,"html_url":"https://github.com/scrapy/scrapy/pull/1477","diff_url":"https://github.com/scrapy/scrapy/pull/1477.diff","patch_url":"https://github.com/scrapy/scrapy/pull/1477.patch","issue_url":"https://api.github.com/repos/scrapy/scrapy/issues/1477","number":1477,"state":"open","locked":false,"title":"equal_attributes function optimization","user":{"login":"mlyundin","id":3119572,"avatar_url":"https://avatars.githubusercontent.com/u/3119572?v=3","gravatar_id":"","url":"https://api.github.com/users/mlyundin","html_url":"https://github.com/mlyundin","followers_url":"https://api.github.com/users/mlyundin/followers","following_url":"https://api.github.com/users/mlyundin/following{/other_user}","gists_url":"https://api.github.com/users/mlyundin/gists{/gist_id}","starred_url":"https://api.github.com/users/mlyundin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mlyundin/subscriptions","organizations_url":"https://api.github.com/users/mlyundin/orgs","repos_url":"https://api.github.com/users/mlyundin/repos","events_url":"https://api.github.com/users/mlyundin/events{/privacy}","received_events_url":"https://api.github.com/users/mlyundin/received_events","type":"User","site_admin":false},"body":"Please review. From my point of view now function looks better.","created_at":"2015-09-03T19:54:41Z","updated_at":"2015-09-03T20:15:41Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7e77c37094cfcd2524437cfe97d058613abbf62b","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/scrapy/scrapy/pulls/1477/commits","review_comments_url":"https://api.github.com/repos/scrapy/scrapy/pulls/1477/comments","review_comment_url":"https://api.github.com/repos/scrapy/scrapy/pulls/comments{/number}","comments_url":"https://api.github.com/repos/scrapy/scrapy/issues/1477/comments","statuses_url":"https://api.github.com/repos/scrapy/scrapy/statuses/6c8176aecd98d76fe3bf51a50b0fcb746a006607","head":{"label":"mlyundin:master","ref":"master","sha":"6c8176aecd98d76fe3bf51a50b0fcb746a006607","user":{"login":"mlyundin","id":3119572,"avatar_url":"https://avatars.githubusercontent.com/u/3119572?v=3","gravatar_id":"","url":"https://api.github.com/users/mlyundin","html_url":"https://github.com/mlyundin","followers_url":"https://api.github.com/users/mlyundin/followers","following_url":"https://api.github.com/users/mlyundin/following{/other_user}","gists_url":"https://api.github.com/users/mlyundin/gists{/gist_id}","starred_url":"https://api.github.com/users/mlyundin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mlyundin/subscriptions","organizations_url":"https://api.github.com/users/mlyundin/orgs","repos_url":"https://api.github.com/users/mlyundin/repos","events_url":"https://api.github.com/users/mlyundin/events{/privacy}","received_events_url":"https://api.github.com/users/mlyundin/received_events","type":"User","site_admin":false},"repo":{"id":40253538,"name":"scrapy","full_name":"mlyundin/scrapy","owner":{"login":"mlyundin","id":3119572,"avatar_url":"https://avatars.githubusercontent.com/u/3119572?v=3","gravatar_id":"","url":"https://api.github.com/users/mlyundin","html_url":"https://github.com/mlyundin","followers_url":"https://api.github.com/users/mlyundin/followers","following_url":"https://api.github.com/users/mlyundin/following{/other_user}","gists_url":"https://api.github.com/users/mlyundin/gists{/gist_id}","starred_url":"https://api.github.com/users/mlyundin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mlyundin/subscriptions","organizations_url":"https://api.github.com/users/mlyundin/orgs","repos_url":"https://api.github.com/users/mlyundin/repos","events_url":"https://api.github.com/users/mlyundin/events{/privacy}","received_events_url":"https://api.github.com/users/mlyundin/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mlyundin/scrapy","description":"Scrapy, a fast high-level web crawling & scraping framework for Python.","fork":true,"url":"https://api.github.com/repos/mlyundin/scrapy","forks_url":"https://api.github.com/repos/mlyundin/scrapy/forks","keys_url":"https://api.github.com/repos/mlyundin/scrapy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mlyundin/scrapy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mlyundin/scrapy/teams","hooks_url":"https://api.github.com/repos/mlyundin/scrapy/hooks","issue_events_url":"https://api.github.com/repos/mlyundin/scrapy/issues/events{/number}","events_url":"https://api.github.com/repos/mlyundin/scrapy/events","assignees_url":"https://api.github.com/repos/mlyundin/scrapy/assignees{/user}","branches_url":"https://api.github.com/repos/mlyundin/scrapy/branches{/branch}","tags_url":"https://api.github.com/repos/mlyundin/scrapy/tags","blobs_url":"https://api.github.com/repos/mlyundin/scrapy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mlyundin/scrapy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mlyundin/scrapy/git/refs{/sha}","trees_url":"https://api.github.com/repos/mlyundin/scrapy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mlyundin/scrapy/statuses/{sha}","languages_url":"https://api.github.com/repos/mlyundin/scrapy/languages","stargazers_url":"https://api.github.com/repos/mlyundin/scrapy/stargazers","contributors_url":"https://api.github.com/repos/mlyundin/scrapy/contributors","subscribers_url":"https://api.github.com/repos/mlyundin/scrapy/subscribers","subscription_url":"https://api.github.com/repos/mlyundin/scrapy/subscription","commits_url":"https://api.github.com/repos/mlyundin/scrapy/commits{/sha}","git_commits_url":"https://api.github.com/repos/mlyundin/scrapy/git/commits{/sha}","comments_url":"https://api.github.com/repos/mlyundin/scrapy/comments{/number}","issue_comment_url":"https://api.github.com/repos/mlyundin/scrapy/issues/comments{/number}","contents_url":"https://api.github.com/repos/mlyundin/scrapy/contents/{+path}","compare_url":"https://api.github.com/repos/mlyundin/scrapy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mlyundin/scrapy/merges","archive_url":"https://api.github.com/repos/mlyundin/scrapy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mlyundin/scrapy/downloads","issues_url":"https://api.github.com/repos/mlyundin/scrapy/issues{/number}","pulls_url":"https://api.github.com/repos/mlyundin/scrapy/pulls{/number}","milestones_url":"https://api.github.com/repos/mlyundin/scrapy/milestones{/number}","notifications_url":"https://api.github.com/repos/mlyundin/scrapy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mlyundin/scrapy/labels{/name}","releases_url":"https://api.github.com/repos/mlyundin/scrapy/releases{/id}","created_at":"2015-08-05T15:32:40Z","updated_at":"2015-08-05T15:32:43Z","pushed_at":"2015-09-03T19:52:57Z","git_url":"git://github.com/mlyundin/scrapy.git","ssh_url":"git@github.com:mlyundin/scrapy.git","clone_url":"https://github.com/mlyundin/scrapy.git","svn_url":"https://github.com/mlyundin/scrapy","homepage":"http://scrapy.org","size":14452,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":false,"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":"scrapy:master","ref":"master","sha":"6ae8963256f52bcc26ea8b4edc938743b07b6b2c","user":{"login":"scrapy","id":733635,"avatar_url":"https://avatars.githubusercontent.com/u/733635?v=3","gravatar_id":"","url":"https://api.github.com/users/scrapy","html_url":"https://github.com/scrapy","followers_url":"https://api.github.com/users/scrapy/followers","following_url":"https://api.github.com/users/scrapy/following{/other_user}","gists_url":"https://api.github.com/users/scrapy/gists{/gist_id}","starred_url":"https://api.github.com/users/scrapy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scrapy/subscriptions","organizations_url":"https://api.github.com/users/scrapy/orgs","repos_url":"https://api.github.com/users/scrapy/repos","events_url":"https://api.github.com/users/scrapy/events{/privacy}","received_events_url":"https://api.github.com/users/scrapy/received_events","type":"Organization","site_admin":false},"repo":{"id":529502,"name":"scrapy","full_name":"scrapy/scrapy","owner":{"login":"scrapy","id":733635,"avatar_url":"https://avatars.githubusercontent.com/u/733635?v=3","gravatar_id":"","url":"https://api.github.com/users/scrapy","html_url":"https://github.com/scrapy","followers_url":"https://api.github.com/users/scrapy/followers","following_url":"https://api.github.com/users/scrapy/following{/other_user}","gists_url":"https://api.github.com/users/scrapy/gists{/gist_id}","starred_url":"https://api.github.com/users/scrapy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scrapy/subscriptions","organizations_url":"https://api.github.com/users/scrapy/orgs","repos_url":"https://api.github.com/users/scrapy/repos","events_url":"https://api.github.com/users/scrapy/events{/privacy}","received_events_url":"https://api.github.com/users/scrapy/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/scrapy/scrapy","description":"Scrapy, a fast high-level web crawling & scraping framework for Python.","fork":false,"url":"https://api.github.com/repos/scrapy/scrapy","forks_url":"https://api.github.com/repos/scrapy/scrapy/forks","keys_url":"https://api.github.com/repos/scrapy/scrapy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/scrapy/scrapy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/scrapy/scrapy/teams","hooks_url":"https://api.github.com/repos/scrapy/scrapy/hooks","issue_events_url":"https://api.github.com/repos/scrapy/scrapy/issues/events{/number}","events_url":"https://api.github.com/repos/scrapy/scrapy/events","assignees_url":"https://api.github.com/repos/scrapy/scrapy/assignees{/user}","branches_url":"https://api.github.com/repos/scrapy/scrapy/branches{/branch}","tags_url":"https://api.github.com/repos/scrapy/scrapy/tags","blobs_url":"https://api.github.com/repos/scrapy/scrapy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/scrapy/scrapy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/scrapy/scrapy/git/refs{/sha}","trees_url":"https://api.github.com/repos/scrapy/scrapy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/scrapy/scrapy/statuses/{sha}","languages_url":"https://api.github.com/repos/scrapy/scrapy/languages","stargazers_url":"https://api.github.com/repos/scrapy/scrapy/stargazers","contributors_url":"https://api.github.com/repos/scrapy/scrapy/contributors","subscribers_url":"https://api.github.com/repos/scrapy/scrapy/subscribers","subscription_url":"https://api.github.com/repos/scrapy/scrapy/subscription","commits_url":"https://api.github.com/repos/scrapy/scrapy/commits{/sha}","git_commits_url":"https://api.github.com/repos/scrapy/scrapy/git/commits{/sha}","comments_url":"https://api.github.com/repos/scrapy/scrapy/comments{/number}","issue_comment_url":"https://api.github.com/repos/scrapy/scrapy/issues/comments{/number}","contents_url":"https://api.github.com/repos/scrapy/scrapy/contents/{+path}","compare_url":"https://api.github.com/repos/scrapy/scrapy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/scrapy/scrapy/merges","archive_url":"https://api.github.com/repos/scrapy/scrapy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/scrapy/scrapy/downloads","issues_url":"https://api.github.com/repos/scrapy/scrapy/issues{/number}","pulls_url":"https://api.github.com/repos/scrapy/scrapy/pulls{/number}","milestones_url":"https://api.github.com/repos/scrapy/scrapy/milestones{/number}","notifications_url":"https://api.github.com/repos/scrapy/scrapy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/scrapy/scrapy/labels{/name}","releases_url":"https://api.github.com/repos/scrapy/scrapy/releases{/id}","created_at":"2010-02-22T02:01:14Z","updated_at":"2015-09-03T17:59:29Z","pushed_at":"2015-09-03T19:54:41Z","git_url":"git://github.com/scrapy/scrapy.git","ssh_url":"git@github.com:scrapy/scrapy.git","clone_url":"https://github.com/scrapy/scrapy.git","svn_url":"https://github.com/scrapy/scrapy","homepage":"http://scrapy.org","size":28697,"stargazers_count":10109,"watchers_count":10109,"language":"Python","has_issues":true,"has_downloads":false,"has_wiki":true,"has_pages":false,"forks_count":2892,"mirror_url":null,"open_issues_count":280,"forks":2892,"open_issues":280,"watchers":10109,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/scrapy/scrapy/pulls/1477"},"html":{"href":"https://github.com/scrapy/scrapy/pull/1477"},"issue":{"href":"https://api.github.com/repos/scrapy/scrapy/issues/1477"},"comments":{"href":"https://api.github.com/repos/scrapy/scrapy/issues/1477/comments"},"review_comments":{"href":"https://api.github.com/repos/scrapy/scrapy/pulls/1477/comments"},"review_comment":{"href":"https://api.github.com/repos/scrapy/scrapy/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/scrapy/scrapy/pulls/1477/commits"},"statuses":{"href":"https://api.github.com/repos/scrapy/scrapy/statuses/6c8176aecd98d76fe3bf51a50b0fcb746a006607"}}}}