{"action":"created","issue":{"url":"https://api.github.com/repos/rethinkdb/rethinkdb/issues/416","labels_url":"https://api.github.com/repos/rethinkdb/rethinkdb/issues/416/labels{/name}","comments_url":"https://api.github.com/repos/rethinkdb/rethinkdb/issues/416/comments","events_url":"https://api.github.com/repos/rethinkdb/rethinkdb/issues/416/events","html_url":"https://github.com/rethinkdb/rethinkdb/issues/416","id":11741616,"number":416,"title":"Bring python driver up to python standards","user":{"login":"jdoliner","id":43867,"avatar_url":"https://avatars.githubusercontent.com/u/43867?v=3","gravatar_id":"","url":"https://api.github.com/users/jdoliner","html_url":"https://github.com/jdoliner","followers_url":"https://api.github.com/users/jdoliner/followers","following_url":"https://api.github.com/users/jdoliner/following{/other_user}","gists_url":"https://api.github.com/users/jdoliner/gists{/gist_id}","starred_url":"https://api.github.com/users/jdoliner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jdoliner/subscriptions","organizations_url":"https://api.github.com/users/jdoliner/orgs","repos_url":"https://api.github.com/users/jdoliner/repos","events_url":"https://api.github.com/users/jdoliner/events{/privacy}","received_events_url":"https://api.github.com/users/jdoliner/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/rethinkdb/rethinkdb/labels/Python","name":"Python","color":"fef2c0"},{"url":"https://api.github.com/repos/rethinkdb/rethinkdb/labels/tp:hygiene","name":"tp:hygiene","color":"ededed"}],"state":"closed","locked":false,"assignee":{"login":"larkost","id":7431361,"avatar_url":"https://avatars.githubusercontent.com/u/7431361?v=3","gravatar_id":"","url":"https://api.github.com/users/larkost","html_url":"https://github.com/larkost","followers_url":"https://api.github.com/users/larkost/followers","following_url":"https://api.github.com/users/larkost/following{/other_user}","gists_url":"https://api.github.com/users/larkost/gists{/gist_id}","starred_url":"https://api.github.com/users/larkost/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/larkost/subscriptions","organizations_url":"https://api.github.com/users/larkost/orgs","repos_url":"https://api.github.com/users/larkost/repos","events_url":"https://api.github.com/users/larkost/events{/privacy}","received_events_url":"https://api.github.com/users/larkost/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/rethinkdb/rethinkdb/milestones/2","html_url":"https://github.com/rethinkdb/rethinkdb/milestones/backlog","labels_url":"https://api.github.com/repos/rethinkdb/rethinkdb/milestones/2/labels","id":211054,"number":2,"title":"backlog","description":"Issues in this milestone are not an immediate priority, and will be periodically revisited. When we decide to work on an issue in backlog, we'll move it to next.","creator":{"login":"coffeemug","id":48436,"avatar_url":"https://avatars.githubusercontent.com/u/48436?v=3","gravatar_id":"","url":"https://api.github.com/users/coffeemug","html_url":"https://github.com/coffeemug","followers_url":"https://api.github.com/users/coffeemug/followers","following_url":"https://api.github.com/users/coffeemug/following{/other_user}","gists_url":"https://api.github.com/users/coffeemug/gists{/gist_id}","starred_url":"https://api.github.com/users/coffeemug/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coffeemug/subscriptions","organizations_url":"https://api.github.com/users/coffeemug/orgs","repos_url":"https://api.github.com/users/coffeemug/repos","events_url":"https://api.github.com/users/coffeemug/events{/privacy}","received_events_url":"https://api.github.com/users/coffeemug/received_events","type":"User","site_admin":false},"open_issues":548,"closed_issues":3,"state":"open","created_at":"2012-11-11T14:16:11Z","updated_at":"2015-10-20T19:35:48Z","due_on":null,"closed_at":null},"comments":14,"created_at":"2013-03-07T01:09:05Z","updated_at":"2015-10-20T19:35:48Z","closed_at":"2015-10-20T19:35:48Z","body":"The new python driver has several things that look very strange to me as a python programmer. The following things in particular:\r\n\r\n- There's no documentation, this means that the standard python methods of calling `help(...)` don't work at all and repl's such as BPython don't offer any help.\r\n\r\n- it leaks a lot of its internal structures on import. We have a pretty common pattern in it that we have a class to represent an AST node and then a function which instantiates that class. It's very confusing to see both `r.db` and `r.DB` especially since neither has any documentation. This is also bad because it doubles the number of things in the module which gives you more to scan through. It also shows a number of things that have no meaning to a user such as `p` and `T`.\r\n\r\n- Operators `all` and `any` are only present as the classes `Any` and `All` this is inconsistent because you call `branch` as `r.branch` but `any` as `r.Any`. I also suspect this isn't reflected in our docs and is incongruous with the other drivers.\r\n\r\n- Many of the objects aren't Thread safe. I'm not 100% sure what python programmer expectations are on this but the way we break when connections and functions are passed between threads is going to be very confusing. \r\n\r\n@timmaxw would you mind also taking a look at this code. It's in the branch ql-refactor in drivers/python2."},"comment":{"url":"https://api.github.com/repos/rethinkdb/rethinkdb/issues/comments/149678089","html_url":"https://github.com/rethinkdb/rethinkdb/issues/416#issuecomment-149678089","issue_url":"https://api.github.com/repos/rethinkdb/rethinkdb/issues/416","id":149678089,"user":{"login":"larkost","id":7431361,"avatar_url":"https://avatars.githubusercontent.com/u/7431361?v=3","gravatar_id":"","url":"https://api.github.com/users/larkost","html_url":"https://github.com/larkost","followers_url":"https://api.github.com/users/larkost/followers","following_url":"https://api.github.com/users/larkost/following{/other_user}","gists_url":"https://api.github.com/users/larkost/gists{/gist_id}","starred_url":"https://api.github.com/users/larkost/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/larkost/subscriptions","organizations_url":"https://api.github.com/users/larkost/orgs","repos_url":"https://api.github.com/users/larkost/repos","events_url":"https://api.github.com/users/larkost/events{/privacy}","received_events_url":"https://api.github.com/users/larkost/received_events","type":"User","site_admin":false},"created_at":"2015-10-20T19:35:48Z","updated_at":"2015-10-20T19:35:48Z","body":"This is an old issue, with a lot of conversation. We actually have everything but one done:\r\n\r\n- [x] `help()` does not work - done in 2013 or before\r\n- [x] leaks internal structures on import - done in #2343\r\n- [x] `r.any` and `r.all` were removed at some point\r\n- [ ] Python driver does not support multiple threads - covered in #2427 and #4448\r\n- [x] `Cursor` and `Connection` should inherit from `object`\r\n- [x] `RDBBase`, `RDBOp`, `RDBValue`, `RDBMethod`, `RDBTopFun`, and `RDBBiOper` could be subclasses of `RDBValue` - all replaced at some point\r\n- [x] `Connection` should be publicly available\r\n- [x] `Cursor` should discard old results\r\n- [x] `Connection` should throw RethinkDB specific errors\r\n- [x] `Cursor.__del__` should close the connection with a `Cursor.close()`\r\n- [x] Use `None` (as opposed to `()`) to denote empty keyword arguments\r\n- [x] In expr(): Consider replacing isinstance(val, types.LambdaType) with callable(val) - uses `isinstance(val, collections.Callable)` which is the same thing.\r\n- [x] renaming `build()`, `compose()`, `deconstruct()`, and so on to `_build()`, `_compose()`, `_deconstruct()`, etc. so it's obvious that users shouldn't call them - these are now all hidden within the package\r\n- [x] The class `MakeArray` overrides `do()` with something identical to its parent definition - done in 153a96ab\r\n\r\nSo the only issue left is the threading one, and that is well covered in the referenced issues."}}