GitHub PullRequestReviewCommentEvent at 2014-02-16 08:12:55
Repository: PyMVPA
Actor: hanke
Payload: {"comment":{"url":"https://api.github.com/repos/neurosbh/PyMVPA/pulls/comments/9776217","id":9776217,"diff_hunk":"@@ -210,26 +71,26 @@ def __init__(self, default, constraints=None, ro=False,  index=None,  value=None\n           cannot be changed\n         value\n           Actual value of the parameter to be assigned\n-          \n+\n         Examples\n         --------\n-        -ensure the parameter to be of type float \n+        -ensure the parameter to be of type float\n         (None not allowed as value):\n         constraints = EnsureFloat()\n         >>> from mvpa2.base.param import Parameter, EnsureFloat\n         >>> C = Parameter(23.0,constraints=EnsureFloat())\n \n         -ensure the parameter to be of type float or to be None:\n-        >>> from mvpa2.base.param import Parameter, EnsureFloat, OrConstrainer\n-        >>> C = Parameter(23.0,constraints=OrConstrainer((EnsureFloat(), None)))\n-          \n-        -ensure the parameter to be None or to be of type float \n-        and lie in the inclusive range (7.0,44.0):          \n-        >>> from mvpa2.base.param import Parameter, EnsureFloat, EnsureRange, \n-        ...                              OrConstrainer, AndConstrainer\n-        >>> C = Parameter(23.0, OrConstrainer((AndConstrainer( (EnsureFloat(), \n-        ...                                    EnsureRange(min=7.0,max=44.0))),\n-        ...                                    None)))\n+        >>> from mvpa2.base.param import Parameter, EnsureFloat, AltConstraints\n+        >>> C = Parameter(23.0,constraints=AltConstraints(EnsureFloat(), None))","path":"mvpa2/base/param.py","position":173,"original_position":173,"commit_id":"afdcf6c5b12a56d5e5df1339e863ce29041d4c5a","original_commit_id":"afdcf6c5b12a56d5e5df1339e863ce29041d4c5a","user":{"login":"hanke","id":136479,"avatar_url":"https://gravatar.com/avatar/f881df265a423e4f24eff27c623148fd?d=https%3A%2F%2Fidenticons.github.com%2Fc6ed748530c47d1dd8d36b1ddc724e03.png&r=x","gravatar_id":"f881df265a423e4f24eff27c623148fd","url":"https://api.github.com/users/hanke","html_url":"https://github.com/hanke","followers_url":"https://api.github.com/users/hanke/followers","following_url":"https://api.github.com/users/hanke/following{/other_user}","gists_url":"https://api.github.com/users/hanke/gists{/gist_id}","starred_url":"https://api.github.com/users/hanke/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hanke/subscriptions","organizations_url":"https://api.github.com/users/hanke/orgs","repos_url":"https://api.github.com/users/hanke/repos","events_url":"https://api.github.com/users/hanke/events{/privacy}","received_events_url":"https://api.github.com/users/hanke/received_events","type":"User","site_admin":false},"body":"type='float' is not very handy for the command line. This is what I had before, but now you'd need to implement support for a finite number of types. Once you get into OR and AND of type alternatives you are lost -- and we have these cases. The above says \"either None or a float\". The default value is also subject to this test -- which is the proper way I think.\r\n\r\nThe current parameter implementation has an additional complication in that there is an 'initial' value (value=), which may or may  not be identical with the 'default' (default=). I am not sure what motivated this implementation, but I'd prefer to re-evaluate and simplify if possible.","created_at":"2014-02-16T08:12:55Z","updated_at":"2014-02-16T08:12:55Z","html_url":"https://github.com/neurosbh/PyMVPA/pull/3#discussion_r9776217","pull_request_url":"https://api.github.com/repos/neurosbh/PyMVPA/pulls/3","_links":{"self":{"href":"https://api.github.com/repos/neurosbh/PyMVPA/pulls/comments/9776217"},"html":{"href":"https://github.com/neurosbh/PyMVPA/pull/3#discussion_r9776217"},"pull_request":{"href":"https://api.github.com/repos/neurosbh/PyMVPA/pulls/3"}}}}