{"action":"created","comment":{"url":"https://api.github.com/repos/sympy/sympy/pulls/comments/54254168","id":54254168,"diff_hunk":"@@ -46,9 +46,25 @@ singleton\n \n S\n ^\n-.. autoclass:: S\n+.. autoclass:: Singleton\n    :members:\n \n+.. note:: Some important points.\n+\n+   1.Normally the first invocation of this class creates the unique instance of the class and\n+   subsequent invocations would simply return a reference to the instance created earlier.\n+   `S.One` denotes a singleton object in SymPy having value `Integer(1)`.The `S object` makes it so\n+   that only one instance of `Integer(1)` is ever created.The reason that these are stored in this way\n+   is because of their frequent use throughout the codebase, which makes it more efficient.\n+\n+   2. Most Integers -- even identical ones like `Integer(1)` and `Integer(1)` -- get stored\n+   at arbitrary memory locations and tests for equality between them and a value must be\n+   done with the `==` operator: `x == 1`.By having a single instance, SymPy enables two optimizations.\n+   First, it saves memory. Second, you can compare against these objects using is comparison, like x is S.One. Because only one instance can ever exist Integer(1) is always the same as S.One.\n+\n+   * There are several objects in SymPy which are implemented as singletons.Some of them are ``S.NegativeOne``, ``S.Zero``, ``S.NegativeInfinity``, ``S.EmptySet``, ``S.Infinity`` and others can be seen by running `dir(S)`.Ignore the ones that start with ``__``  those are Python internal methods.\n+","path":"doc/src/modules/core.rst","position":null,"original_position":22,"commit_id":"646eca6a558f4f17d235bce286a94e38212f2a2d","original_commit_id":"26b50acd064a44d0e152186d4c161f287588b5f5","user":{"login":"Shekharrajak","id":5774448,"avatar_url":"https://avatars.githubusercontent.com/u/5774448?v=3","gravatar_id":"","url":"https://api.github.com/users/Shekharrajak","html_url":"https://github.com/Shekharrajak","followers_url":"https://api.github.com/users/Shekharrajak/followers","following_url":"https://api.github.com/users/Shekharrajak/following{/other_user}","gists_url":"https://api.github.com/users/Shekharrajak/gists{/gist_id}","starred_url":"https://api.github.com/users/Shekharrajak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Shekharrajak/subscriptions","organizations_url":"https://api.github.com/users/Shekharrajak/orgs","repos_url":"https://api.github.com/users/Shekharrajak/repos","events_url":"https://api.github.com/users/Shekharrajak/events{/privacy}","received_events_url":"https://api.github.com/users/Shekharrajak/received_events","type":"User","site_admin":false},"body":"Done @leosartaj ","created_at":"2016-02-26T15:07:54Z","updated_at":"2016-02-26T15:07:54Z","html_url":"https://github.com/sympy/sympy/pull/10494#discussion_r54254168","pull_request_url":"https://api.github.com/repos/sympy/sympy/pulls/10494","_links":{"self":{"href":"https://api.github.com/repos/sympy/sympy/pulls/comments/54254168"},"html":{"href":"https://github.com/sympy/sympy/pull/10494#discussion_r54254168"},"pull_request":{"href":"https://api.github.com/repos/sympy/sympy/pulls/10494"}}},"pull_request":{"url":"https://api.github.com/repos/sympy/sympy/pulls/10494","id":57735589,"html_url":"https://github.com/sympy/sympy/pull/10494","diff_url":"https://github.com/sympy/sympy/pull/10494.diff","patch_url":"https://github.com/sympy/sympy/pull/10494.patch","issue_url":"https://api.github.com/repos/sympy/sympy/issues/10494","number":10494,"state":"open","locked":false,"title":"Few lines added in docs for singleton, S","user":{"login":"Shekharrajak","id":5774448,"avatar_url":"https://avatars.githubusercontent.com/u/5774448?v=3","gravatar_id":"","url":"https://api.github.com/users/Shekharrajak","html_url":"https://github.com/Shekharrajak","followers_url":"https://api.github.com/users/Shekharrajak/followers","following_url":"https://api.github.com/users/Shekharrajak/following{/other_user}","gists_url":"https://api.github.com/users/Shekharrajak/gists{/gist_id}","starred_url":"https://api.github.com/users/Shekharrajak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Shekharrajak/subscriptions","organizations_url":"https://api.github.com/users/Shekharrajak/orgs","repos_url":"https://api.github.com/users/Shekharrajak/repos","events_url":"https://api.github.com/users/Shekharrajak/events{/privacy}","received_events_url":"https://api.github.com/users/Shekharrajak/received_events","type":"User","site_admin":false},"body":"Please suggest if something more can be added.","created_at":"2016-01-30T09:38:20Z","updated_at":"2016-02-26T15:07:54Z","closed_at":null,"merged_at":null,"merge_commit_sha":"63dfa398ad0770de804d6f0fc52d62be45541df4","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/sympy/sympy/pulls/10494/commits","review_comments_url":"https://api.github.com/repos/sympy/sympy/pulls/10494/comments","review_comment_url":"https://api.github.com/repos/sympy/sympy/pulls/comments{/number}","comments_url":"https://api.github.com/repos/sympy/sympy/issues/10494/comments","statuses_url":"https://api.github.com/repos/sympy/sympy/statuses/646eca6a558f4f17d235bce286a94e38212f2a2d","head":{"label":"Shekharrajak:singleton_docs","ref":"singleton_docs","sha":"646eca6a558f4f17d235bce286a94e38212f2a2d","user":{"login":"Shekharrajak","id":5774448,"avatar_url":"https://avatars.githubusercontent.com/u/5774448?v=3","gravatar_id":"","url":"https://api.github.com/users/Shekharrajak","html_url":"https://github.com/Shekharrajak","followers_url":"https://api.github.com/users/Shekharrajak/followers","following_url":"https://api.github.com/users/Shekharrajak/following{/other_user}","gists_url":"https://api.github.com/users/Shekharrajak/gists{/gist_id}","starred_url":"https://api.github.com/users/Shekharrajak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Shekharrajak/subscriptions","organizations_url":"https://api.github.com/users/Shekharrajak/orgs","repos_url":"https://api.github.com/users/Shekharrajak/repos","events_url":"https://api.github.com/users/Shekharrajak/events{/privacy}","received_events_url":"https://api.github.com/users/Shekharrajak/received_events","type":"User","site_admin":false},"repo":{"id":42365606,"name":"sympy","full_name":"Shekharrajak/sympy","owner":{"login":"Shekharrajak","id":5774448,"avatar_url":"https://avatars.githubusercontent.com/u/5774448?v=3","gravatar_id":"","url":"https://api.github.com/users/Shekharrajak","html_url":"https://github.com/Shekharrajak","followers_url":"https://api.github.com/users/Shekharrajak/followers","following_url":"https://api.github.com/users/Shekharrajak/following{/other_user}","gists_url":"https://api.github.com/users/Shekharrajak/gists{/gist_id}","starred_url":"https://api.github.com/users/Shekharrajak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Shekharrajak/subscriptions","organizations_url":"https://api.github.com/users/Shekharrajak/orgs","repos_url":"https://api.github.com/users/Shekharrajak/repos","events_url":"https://api.github.com/users/Shekharrajak/events{/privacy}","received_events_url":"https://api.github.com/users/Shekharrajak/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Shekharrajak/sympy","description":"A computer algebra system written in pure Python","fork":true,"url":"https://api.github.com/repos/Shekharrajak/sympy","forks_url":"https://api.github.com/repos/Shekharrajak/sympy/forks","keys_url":"https://api.github.com/repos/Shekharrajak/sympy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Shekharrajak/sympy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Shekharrajak/sympy/teams","hooks_url":"https://api.github.com/repos/Shekharrajak/sympy/hooks","issue_events_url":"https://api.github.com/repos/Shekharrajak/sympy/issues/events{/number}","events_url":"https://api.github.com/repos/Shekharrajak/sympy/events","assignees_url":"https://api.github.com/repos/Shekharrajak/sympy/assignees{/user}","branches_url":"https://api.github.com/repos/Shekharrajak/sympy/branches{/branch}","tags_url":"https://api.github.com/repos/Shekharrajak/sympy/tags","blobs_url":"https://api.github.com/repos/Shekharrajak/sympy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Shekharrajak/sympy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Shekharrajak/sympy/git/refs{/sha}","trees_url":"https://api.github.com/repos/Shekharrajak/sympy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Shekharrajak/sympy/statuses/{sha}","languages_url":"https://api.github.com/repos/Shekharrajak/sympy/languages","stargazers_url":"https://api.github.com/repos/Shekharrajak/sympy/stargazers","contributors_url":"https://api.github.com/repos/Shekharrajak/sympy/contributors","subscribers_url":"https://api.github.com/repos/Shekharrajak/sympy/subscribers","subscription_url":"https://api.github.com/repos/Shekharrajak/sympy/subscription","commits_url":"https://api.github.com/repos/Shekharrajak/sympy/commits{/sha}","git_commits_url":"https://api.github.com/repos/Shekharrajak/sympy/git/commits{/sha}","comments_url":"https://api.github.com/repos/Shekharrajak/sympy/comments{/number}","issue_comment_url":"https://api.github.com/repos/Shekharrajak/sympy/issues/comments{/number}","contents_url":"https://api.github.com/repos/Shekharrajak/sympy/contents/{+path}","compare_url":"https://api.github.com/repos/Shekharrajak/sympy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Shekharrajak/sympy/merges","archive_url":"https://api.github.com/repos/Shekharrajak/sympy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Shekharrajak/sympy/downloads","issues_url":"https://api.github.com/repos/Shekharrajak/sympy/issues{/number}","pulls_url":"https://api.github.com/repos/Shekharrajak/sympy/pulls{/number}","milestones_url":"https://api.github.com/repos/Shekharrajak/sympy/milestones{/number}","notifications_url":"https://api.github.com/repos/Shekharrajak/sympy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Shekharrajak/sympy/labels{/name}","releases_url":"https://api.github.com/repos/Shekharrajak/sympy/releases{/id}","deployments_url":"https://api.github.com/repos/Shekharrajak/sympy/deployments","created_at":"2015-09-12T17:09:44Z","updated_at":"2016-02-09T11:08:45Z","pushed_at":"2016-02-26T06:00:16Z","git_url":"git://github.com/Shekharrajak/sympy.git","ssh_url":"git@github.com:Shekharrajak/sympy.git","clone_url":"https://github.com/Shekharrajak/sympy.git","svn_url":"https://github.com/Shekharrajak/sympy","homepage":"http://sympy.org/","size":75420,"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":"sympy:master","ref":"master","sha":"878e343f87e3fcad2aa87a154c83620dbf30f8ac","user":{"login":"sympy","id":260832,"avatar_url":"https://avatars.githubusercontent.com/u/260832?v=3","gravatar_id":"","url":"https://api.github.com/users/sympy","html_url":"https://github.com/sympy","followers_url":"https://api.github.com/users/sympy/followers","following_url":"https://api.github.com/users/sympy/following{/other_user}","gists_url":"https://api.github.com/users/sympy/gists{/gist_id}","starred_url":"https://api.github.com/users/sympy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sympy/subscriptions","organizations_url":"https://api.github.com/users/sympy/orgs","repos_url":"https://api.github.com/users/sympy/repos","events_url":"https://api.github.com/users/sympy/events{/privacy}","received_events_url":"https://api.github.com/users/sympy/received_events","type":"Organization","site_admin":false},"repo":{"id":640534,"name":"sympy","full_name":"sympy/sympy","owner":{"login":"sympy","id":260832,"avatar_url":"https://avatars.githubusercontent.com/u/260832?v=3","gravatar_id":"","url":"https://api.github.com/users/sympy","html_url":"https://github.com/sympy","followers_url":"https://api.github.com/users/sympy/followers","following_url":"https://api.github.com/users/sympy/following{/other_user}","gists_url":"https://api.github.com/users/sympy/gists{/gist_id}","starred_url":"https://api.github.com/users/sympy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sympy/subscriptions","organizations_url":"https://api.github.com/users/sympy/orgs","repos_url":"https://api.github.com/users/sympy/repos","events_url":"https://api.github.com/users/sympy/events{/privacy}","received_events_url":"https://api.github.com/users/sympy/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/sympy/sympy","description":"A computer algebra system written in pure Python","fork":false,"url":"https://api.github.com/repos/sympy/sympy","forks_url":"https://api.github.com/repos/sympy/sympy/forks","keys_url":"https://api.github.com/repos/sympy/sympy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sympy/sympy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sympy/sympy/teams","hooks_url":"https://api.github.com/repos/sympy/sympy/hooks","issue_events_url":"https://api.github.com/repos/sympy/sympy/issues/events{/number}","events_url":"https://api.github.com/repos/sympy/sympy/events","assignees_url":"https://api.github.com/repos/sympy/sympy/assignees{/user}","branches_url":"https://api.github.com/repos/sympy/sympy/branches{/branch}","tags_url":"https://api.github.com/repos/sympy/sympy/tags","blobs_url":"https://api.github.com/repos/sympy/sympy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sympy/sympy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sympy/sympy/git/refs{/sha}","trees_url":"https://api.github.com/repos/sympy/sympy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sympy/sympy/statuses/{sha}","languages_url":"https://api.github.com/repos/sympy/sympy/languages","stargazers_url":"https://api.github.com/repos/sympy/sympy/stargazers","contributors_url":"https://api.github.com/repos/sympy/sympy/contributors","subscribers_url":"https://api.github.com/repos/sympy/sympy/subscribers","subscription_url":"https://api.github.com/repos/sympy/sympy/subscription","commits_url":"https://api.github.com/repos/sympy/sympy/commits{/sha}","git_commits_url":"https://api.github.com/repos/sympy/sympy/git/commits{/sha}","comments_url":"https://api.github.com/repos/sympy/sympy/comments{/number}","issue_comment_url":"https://api.github.com/repos/sympy/sympy/issues/comments{/number}","contents_url":"https://api.github.com/repos/sympy/sympy/contents/{+path}","compare_url":"https://api.github.com/repos/sympy/sympy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sympy/sympy/merges","archive_url":"https://api.github.com/repos/sympy/sympy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sympy/sympy/downloads","issues_url":"https://api.github.com/repos/sympy/sympy/issues{/number}","pulls_url":"https://api.github.com/repos/sympy/sympy/pulls{/number}","milestones_url":"https://api.github.com/repos/sympy/sympy/milestones{/number}","notifications_url":"https://api.github.com/repos/sympy/sympy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sympy/sympy/labels{/name}","releases_url":"https://api.github.com/repos/sympy/sympy/releases{/id}","deployments_url":"https://api.github.com/repos/sympy/sympy/deployments","created_at":"2010-04-30T20:37:14Z","updated_at":"2016-02-25T07:36:36Z","pushed_at":"2016-02-26T13:52:05Z","git_url":"git://github.com/sympy/sympy.git","ssh_url":"git@github.com:sympy/sympy.git","clone_url":"https://github.com/sympy/sympy.git","svn_url":"https://github.com/sympy/sympy","homepage":"http://sympy.org/","size":104930,"stargazers_count":2648,"watchers_count":2648,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1347,"mirror_url":null,"open_issues_count":2204,"forks":1347,"open_issues":2204,"watchers":2648,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/sympy/sympy/pulls/10494"},"html":{"href":"https://github.com/sympy/sympy/pull/10494"},"issue":{"href":"https://api.github.com/repos/sympy/sympy/issues/10494"},"comments":{"href":"https://api.github.com/repos/sympy/sympy/issues/10494/comments"},"review_comments":{"href":"https://api.github.com/repos/sympy/sympy/pulls/10494/comments"},"review_comment":{"href":"https://api.github.com/repos/sympy/sympy/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/sympy/sympy/pulls/10494/commits"},"statuses":{"href":"https://api.github.com/repos/sympy/sympy/statuses/646eca6a558f4f17d235bce286a94e38212f2a2d"}}}}