{"action":"created","issue":{"url":"https://api.github.com/repos/nigelsmall/py2neo/issues/539","repository_url":"https://api.github.com/repos/nigelsmall/py2neo","labels_url":"https://api.github.com/repos/nigelsmall/py2neo/issues/539/labels{/name}","comments_url":"https://api.github.com/repos/nigelsmall/py2neo/issues/539/comments","events_url":"https://api.github.com/repos/nigelsmall/py2neo/issues/539/events","html_url":"https://github.com/nigelsmall/py2neo/issues/539","id":164092612,"number":539,"title":"Let GraphObject accept kwargs to initialise object ","user":{"login":"mjmare","id":1711378,"avatar_url":"https://avatars.githubusercontent.com/u/1711378?v=3","gravatar_id":"","url":"https://api.github.com/users/mjmare","html_url":"https://github.com/mjmare","followers_url":"https://api.github.com/users/mjmare/followers","following_url":"https://api.github.com/users/mjmare/following{/other_user}","gists_url":"https://api.github.com/users/mjmare/gists{/gist_id}","starred_url":"https://api.github.com/users/mjmare/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mjmare/subscriptions","organizations_url":"https://api.github.com/users/mjmare/orgs","repos_url":"https://api.github.com/users/mjmare/repos","events_url":"https://api.github.com/users/mjmare/events{/privacy}","received_events_url":"https://api.github.com/users/mjmare/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-07-06T14:42:06Z","updated_at":"2016-07-08T15:32:20Z","closed_at":null,"body":"It would be nice to be able to pass kwargs to initialise an object. \r\n\r\nEg\r\n```\r\nclass Person(GraphObject):\r\n    __primarykey__ = \"name\"\r\n    name = Property()\r\n    born = Property()\r\n    \r\np=Person(name='Piet, born='2012')\r\n```\r\n\r\ninstead of:\r\n```\r\np=Person()\r\np.name='Piet'\r\np.born='2012'\r\n```\r\n\r\nThis has the additional advantage of passing a dict to the constructor:\r\n`q=Person(**some_validated_dict)`\r\n\r\ninstead of:\r\n```\r\nq=Person()\r\nfor k,v in some_validated_dict:\r\n  q[k]=v\r\n\r\n```\r\n\r\n\r\n\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/nigelsmall/py2neo/issues/comments/231391695","html_url":"https://github.com/nigelsmall/py2neo/issues/539#issuecomment-231391695","issue_url":"https://api.github.com/repos/nigelsmall/py2neo/issues/539","id":231391695,"user":{"login":"nigelsmall","id":275311,"avatar_url":"https://avatars.githubusercontent.com/u/275311?v=3","gravatar_id":"","url":"https://api.github.com/users/nigelsmall","html_url":"https://github.com/nigelsmall","followers_url":"https://api.github.com/users/nigelsmall/followers","following_url":"https://api.github.com/users/nigelsmall/following{/other_user}","gists_url":"https://api.github.com/users/nigelsmall/gists{/gist_id}","starred_url":"https://api.github.com/users/nigelsmall/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nigelsmall/subscriptions","organizations_url":"https://api.github.com/users/nigelsmall/orgs","repos_url":"https://api.github.com/users/nigelsmall/repos","events_url":"https://api.github.com/users/nigelsmall/events{/privacy}","received_events_url":"https://api.github.com/users/nigelsmall/received_events","type":"User","site_admin":false},"created_at":"2016-07-08T15:32:20Z","updated_at":"2016-07-08T15:32:20Z","body":"The base `GraphObject` deliberately doesn't include a default `__init__`; it's up to base classes to provide a constructor as one may not be desirable in every case.\r\n\r\nI'd suggest that if you want this behaviour, you first subclass `GraphObject` as `ConstructableGraphObject` or something and extend your domain classes from that."}}
{"actor":{"display_login":"nigelsmall"}}