{"action":"created","comment":{"url":"https://api.github.com/repos/odlgroup/odl/pulls/comments/72101053","id":72101053,"diff_hunk":"@@ -825,26 +825,36 @@ class ConstantOperator(Operator):\n     ``ConstantOperator(vector)(x) <==> vector``\n     \"\"\"\n \n-    def __init__(self, vector, domain=None):\n-        \"\"\"Initialize a new instance.\n+    def __init__(self, vector, domain=None, range=None):\n+        \"\"\"Initialize an instance.\n \n         Parameters\n         ----------\n         vector : `LinearSpaceVector`\n             The vector constant to be returned\n-\n-        domain : `LinearSpace`, default : vector.space\n+        domain : `LinearSpace`, optional\n+            default is vector.space\n             The domain of the operator.\n+        range : `LinearSpace`, optional\n+            default : vector.space\n+            The range of the operator.\n         \"\"\"\n-        if not isinstance(vector, LinearSpaceVector):\n-            raise TypeError('`vector` {!r} not a LinearSpaceVector instance'\n-                            ''.format(vector))\n+        if domain is None or range is None:\n+            if not isinstance(vector, LinearSpaceVector):\n+                raise TypeError('If either domain or range is unspecified, '\n+                                '`vector` {!r} has to be a LinearSpaceVector '\n+                                'instance'.format(vector))\n \n         if domain is None:\n             domain = vector.space\n+        if range is None:\n+            range = vector.space\n+        if vector not in range:\n+            raise TypeError('`vector` {!r} in not in the range {}.'\n+                            ''.format(vector, range))","path":"odl/operator/default_ops.py","position":35,"original_position":37,"commit_id":"f22e76288dfc5492d7cfdab38a0b327e3c7a9249","original_commit_id":"43d1083fbd98f4f393112eed48a481147e02e55c","user":{"login":"kohr-h","id":5030250,"avatar_url":"https://avatars.githubusercontent.com/u/5030250?v=3","gravatar_id":"","url":"https://api.github.com/users/kohr-h","html_url":"https://github.com/kohr-h","followers_url":"https://api.github.com/users/kohr-h/followers","following_url":"https://api.github.com/users/kohr-h/following{/other_user}","gists_url":"https://api.github.com/users/kohr-h/gists{/gist_id}","starred_url":"https://api.github.com/users/kohr-h/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kohr-h/subscriptions","organizations_url":"https://api.github.com/users/kohr-h/orgs","repos_url":"https://api.github.com/users/kohr-h/repos","events_url":"https://api.github.com/users/kohr-h/events{/privacy}","received_events_url":"https://api.github.com/users/kohr-h/received_events","type":"User","site_admin":false},"body":"Actually, the casting variant would be better here. One of the (many) principles of Python is \"be generous in what you accept and strict in what you return\". That last \"return\" could also be \"store in a class\". Delegating to `element` allows way more input types.","created_at":"2016-07-25T16:52:32Z","updated_at":"2016-07-25T16:52:32Z","html_url":"https://github.com/odlgroup/odl/pull/498#discussion_r72101053","pull_request_url":"https://api.github.com/repos/odlgroup/odl/pulls/498","_links":{"self":{"href":"https://api.github.com/repos/odlgroup/odl/pulls/comments/72101053"},"html":{"href":"https://github.com/odlgroup/odl/pull/498#discussion_r72101053"},"pull_request":{"href":"https://api.github.com/repos/odlgroup/odl/pulls/498"}}},"pull_request":{"url":"https://api.github.com/repos/odlgroup/odl/pulls/498","id":77972925,"html_url":"https://github.com/odlgroup/odl/pull/498","diff_url":"https://github.com/odlgroup/odl/pull/498.diff","patch_url":"https://github.com/odlgroup/odl/pull/498.patch","issue_url":"https://api.github.com/repos/odlgroup/odl/issues/498","number":498,"state":"open","locked":false,"title":"Issue 246  functional","user":{"login":"aringh","id":15774494,"avatar_url":"https://avatars.githubusercontent.com/u/15774494?v=3","gravatar_id":"","url":"https://api.github.com/users/aringh","html_url":"https://github.com/aringh","followers_url":"https://api.github.com/users/aringh/followers","following_url":"https://api.github.com/users/aringh/following{/other_user}","gists_url":"https://api.github.com/users/aringh/gists{/gist_id}","starred_url":"https://api.github.com/users/aringh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aringh/subscriptions","organizations_url":"https://api.github.com/users/aringh/orgs","repos_url":"https://api.github.com/users/aringh/repos","events_url":"https://api.github.com/users/aringh/events{/privacy}","received_events_url":"https://api.github.com/users/aringh/received_events","type":"User","site_admin":false},"body":"This adds `functional`'s to `odl.solvers`.\r\n\r\nThe branch is not complete yet, but review of parts of it can start (especially the basic functionality in the functional-file).\r\n\r\nMoreover, the commit history is not very nice, but I will update this before merge. ","created_at":"2016-07-19T13:11:21Z","updated_at":"2016-07-25T16:52:32Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3d3e7433b372cdfa2f444c8076c1a0a61da79012","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/odlgroup/odl/pulls/498/commits","review_comments_url":"https://api.github.com/repos/odlgroup/odl/pulls/498/comments","review_comment_url":"https://api.github.com/repos/odlgroup/odl/pulls/comments{/number}","comments_url":"https://api.github.com/repos/odlgroup/odl/issues/498/comments","statuses_url":"https://api.github.com/repos/odlgroup/odl/statuses/f22e76288dfc5492d7cfdab38a0b327e3c7a9249","head":{"label":"odlgroup:issue-246__functional","ref":"issue-246__functional","sha":"f22e76288dfc5492d7cfdab38a0b327e3c7a9249","user":{"login":"odlgroup","id":15667171,"avatar_url":"https://avatars.githubusercontent.com/u/15667171?v=3","gravatar_id":"","url":"https://api.github.com/users/odlgroup","html_url":"https://github.com/odlgroup","followers_url":"https://api.github.com/users/odlgroup/followers","following_url":"https://api.github.com/users/odlgroup/following{/other_user}","gists_url":"https://api.github.com/users/odlgroup/gists{/gist_id}","starred_url":"https://api.github.com/users/odlgroup/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/odlgroup/subscriptions","organizations_url":"https://api.github.com/users/odlgroup/orgs","repos_url":"https://api.github.com/users/odlgroup/repos","events_url":"https://api.github.com/users/odlgroup/events{/privacy}","received_events_url":"https://api.github.com/users/odlgroup/received_events","type":"Organization","site_admin":false},"repo":{"id":45596393,"name":"odl","full_name":"odlgroup/odl","owner":{"login":"odlgroup","id":15667171,"avatar_url":"https://avatars.githubusercontent.com/u/15667171?v=3","gravatar_id":"","url":"https://api.github.com/users/odlgroup","html_url":"https://github.com/odlgroup","followers_url":"https://api.github.com/users/odlgroup/followers","following_url":"https://api.github.com/users/odlgroup/following{/other_user}","gists_url":"https://api.github.com/users/odlgroup/gists{/gist_id}","starred_url":"https://api.github.com/users/odlgroup/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/odlgroup/subscriptions","organizations_url":"https://api.github.com/users/odlgroup/orgs","repos_url":"https://api.github.com/users/odlgroup/repos","events_url":"https://api.github.com/users/odlgroup/events{/privacy}","received_events_url":"https://api.github.com/users/odlgroup/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/odlgroup/odl","description":"Operator Discretization Library","fork":false,"url":"https://api.github.com/repos/odlgroup/odl","forks_url":"https://api.github.com/repos/odlgroup/odl/forks","keys_url":"https://api.github.com/repos/odlgroup/odl/keys{/key_id}","collaborators_url":"https://api.github.com/repos/odlgroup/odl/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/odlgroup/odl/teams","hooks_url":"https://api.github.com/repos/odlgroup/odl/hooks","issue_events_url":"https://api.github.com/repos/odlgroup/odl/issues/events{/number}","events_url":"https://api.github.com/repos/odlgroup/odl/events","assignees_url":"https://api.github.com/repos/odlgroup/odl/assignees{/user}","branches_url":"https://api.github.com/repos/odlgroup/odl/branches{/branch}","tags_url":"https://api.github.com/repos/odlgroup/odl/tags","blobs_url":"https://api.github.com/repos/odlgroup/odl/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/odlgroup/odl/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/odlgroup/odl/git/refs{/sha}","trees_url":"https://api.github.com/repos/odlgroup/odl/git/trees{/sha}","statuses_url":"https://api.github.com/repos/odlgroup/odl/statuses/{sha}","languages_url":"https://api.github.com/repos/odlgroup/odl/languages","stargazers_url":"https://api.github.com/repos/odlgroup/odl/stargazers","contributors_url":"https://api.github.com/repos/odlgroup/odl/contributors","subscribers_url":"https://api.github.com/repos/odlgroup/odl/subscribers","subscription_url":"https://api.github.com/repos/odlgroup/odl/subscription","commits_url":"https://api.github.com/repos/odlgroup/odl/commits{/sha}","git_commits_url":"https://api.github.com/repos/odlgroup/odl/git/commits{/sha}","comments_url":"https://api.github.com/repos/odlgroup/odl/comments{/number}","issue_comment_url":"https://api.github.com/repos/odlgroup/odl/issues/comments{/number}","contents_url":"https://api.github.com/repos/odlgroup/odl/contents/{+path}","compare_url":"https://api.github.com/repos/odlgroup/odl/compare/{base}...{head}","merges_url":"https://api.github.com/repos/odlgroup/odl/merges","archive_url":"https://api.github.com/repos/odlgroup/odl/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/odlgroup/odl/downloads","issues_url":"https://api.github.com/repos/odlgroup/odl/issues{/number}","pulls_url":"https://api.github.com/repos/odlgroup/odl/pulls{/number}","milestones_url":"https://api.github.com/repos/odlgroup/odl/milestones{/number}","notifications_url":"https://api.github.com/repos/odlgroup/odl/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/odlgroup/odl/labels{/name}","releases_url":"https://api.github.com/repos/odlgroup/odl/releases{/id}","deployments_url":"https://api.github.com/repos/odlgroup/odl/deployments","created_at":"2015-11-05T07:57:55Z","updated_at":"2016-07-18T06:06:49Z","pushed_at":"2016-07-25T16:21:13Z","git_url":"git://github.com/odlgroup/odl.git","ssh_url":"git@github.com:odlgroup/odl.git","clone_url":"https://github.com/odlgroup/odl.git","svn_url":"https://github.com/odlgroup/odl","homepage":null,"size":19103,"stargazers_count":9,"watchers_count":9,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":6,"mirror_url":null,"open_issues_count":115,"forks":6,"open_issues":115,"watchers":9,"default_branch":"master"}},"base":{"label":"odlgroup:master","ref":"master","sha":"f89eca6adcc6481d45cef9c02b4feef4424d4080","user":{"login":"odlgroup","id":15667171,"avatar_url":"https://avatars.githubusercontent.com/u/15667171?v=3","gravatar_id":"","url":"https://api.github.com/users/odlgroup","html_url":"https://github.com/odlgroup","followers_url":"https://api.github.com/users/odlgroup/followers","following_url":"https://api.github.com/users/odlgroup/following{/other_user}","gists_url":"https://api.github.com/users/odlgroup/gists{/gist_id}","starred_url":"https://api.github.com/users/odlgroup/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/odlgroup/subscriptions","organizations_url":"https://api.github.com/users/odlgroup/orgs","repos_url":"https://api.github.com/users/odlgroup/repos","events_url":"https://api.github.com/users/odlgroup/events{/privacy}","received_events_url":"https://api.github.com/users/odlgroup/received_events","type":"Organization","site_admin":false},"repo":{"id":45596393,"name":"odl","full_name":"odlgroup/odl","owner":{"login":"odlgroup","id":15667171,"avatar_url":"https://avatars.githubusercontent.com/u/15667171?v=3","gravatar_id":"","url":"https://api.github.com/users/odlgroup","html_url":"https://github.com/odlgroup","followers_url":"https://api.github.com/users/odlgroup/followers","following_url":"https://api.github.com/users/odlgroup/following{/other_user}","gists_url":"https://api.github.com/users/odlgroup/gists{/gist_id}","starred_url":"https://api.github.com/users/odlgroup/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/odlgroup/subscriptions","organizations_url":"https://api.github.com/users/odlgroup/orgs","repos_url":"https://api.github.com/users/odlgroup/repos","events_url":"https://api.github.com/users/odlgroup/events{/privacy}","received_events_url":"https://api.github.com/users/odlgroup/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/odlgroup/odl","description":"Operator Discretization Library","fork":false,"url":"https://api.github.com/repos/odlgroup/odl","forks_url":"https://api.github.com/repos/odlgroup/odl/forks","keys_url":"https://api.github.com/repos/odlgroup/odl/keys{/key_id}","collaborators_url":"https://api.github.com/repos/odlgroup/odl/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/odlgroup/odl/teams","hooks_url":"https://api.github.com/repos/odlgroup/odl/hooks","issue_events_url":"https://api.github.com/repos/odlgroup/odl/issues/events{/number}","events_url":"https://api.github.com/repos/odlgroup/odl/events","assignees_url":"https://api.github.com/repos/odlgroup/odl/assignees{/user}","branches_url":"https://api.github.com/repos/odlgroup/odl/branches{/branch}","tags_url":"https://api.github.com/repos/odlgroup/odl/tags","blobs_url":"https://api.github.com/repos/odlgroup/odl/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/odlgroup/odl/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/odlgroup/odl/git/refs{/sha}","trees_url":"https://api.github.com/repos/odlgroup/odl/git/trees{/sha}","statuses_url":"https://api.github.com/repos/odlgroup/odl/statuses/{sha}","languages_url":"https://api.github.com/repos/odlgroup/odl/languages","stargazers_url":"https://api.github.com/repos/odlgroup/odl/stargazers","contributors_url":"https://api.github.com/repos/odlgroup/odl/contributors","subscribers_url":"https://api.github.com/repos/odlgroup/odl/subscribers","subscription_url":"https://api.github.com/repos/odlgroup/odl/subscription","commits_url":"https://api.github.com/repos/odlgroup/odl/commits{/sha}","git_commits_url":"https://api.github.com/repos/odlgroup/odl/git/commits{/sha}","comments_url":"https://api.github.com/repos/odlgroup/odl/comments{/number}","issue_comment_url":"https://api.github.com/repos/odlgroup/odl/issues/comments{/number}","contents_url":"https://api.github.com/repos/odlgroup/odl/contents/{+path}","compare_url":"https://api.github.com/repos/odlgroup/odl/compare/{base}...{head}","merges_url":"https://api.github.com/repos/odlgroup/odl/merges","archive_url":"https://api.github.com/repos/odlgroup/odl/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/odlgroup/odl/downloads","issues_url":"https://api.github.com/repos/odlgroup/odl/issues{/number}","pulls_url":"https://api.github.com/repos/odlgroup/odl/pulls{/number}","milestones_url":"https://api.github.com/repos/odlgroup/odl/milestones{/number}","notifications_url":"https://api.github.com/repos/odlgroup/odl/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/odlgroup/odl/labels{/name}","releases_url":"https://api.github.com/repos/odlgroup/odl/releases{/id}","deployments_url":"https://api.github.com/repos/odlgroup/odl/deployments","created_at":"2015-11-05T07:57:55Z","updated_at":"2016-07-18T06:06:49Z","pushed_at":"2016-07-25T16:21:13Z","git_url":"git://github.com/odlgroup/odl.git","ssh_url":"git@github.com:odlgroup/odl.git","clone_url":"https://github.com/odlgroup/odl.git","svn_url":"https://github.com/odlgroup/odl","homepage":null,"size":19103,"stargazers_count":9,"watchers_count":9,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":6,"mirror_url":null,"open_issues_count":115,"forks":6,"open_issues":115,"watchers":9,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/odlgroup/odl/pulls/498"},"html":{"href":"https://github.com/odlgroup/odl/pull/498"},"issue":{"href":"https://api.github.com/repos/odlgroup/odl/issues/498"},"comments":{"href":"https://api.github.com/repos/odlgroup/odl/issues/498/comments"},"review_comments":{"href":"https://api.github.com/repos/odlgroup/odl/pulls/498/comments"},"review_comment":{"href":"https://api.github.com/repos/odlgroup/odl/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/odlgroup/odl/pulls/498/commits"},"statuses":{"href":"https://api.github.com/repos/odlgroup/odl/statuses/f22e76288dfc5492d7cfdab38a0b327e3c7a9249"}}}}
{"actor":{"display_login":"kohr-h"}}