Closed BigBlueHat closed 10 years ago
That'd be cool. Wanna make a branch that pulls this off?
For my personal curiosity, what makes couchdb-python pythonic?
From "The Zen of Python, by Tim Peters" (aka import this
)
0) Beautiful is better than ugly. 2) Simple is better than complex. 5) Sparse is better than dense. 6) Readability counts.
Possibly others. :grin:
The only tenet that sticks out to me about the CouchDB-Python API is "flat is better than nested", in that their Database
object has a million methods while the Document
object doesn't.
What about Cloudant-Python is ugly, complex, dense, and unreadable?
Wasn't meaning to imply that it was any of those things. Just that matching CouchDB-Python's API would be a Good Thing.
Ah, sorry for the misunderstanding.
+1 on minimizing the delta between the libraries.
One immediate item that comes to mind is in this line: https://github.com/cloudant-labs/cloudant-python/blob/master/cloudant/database.py#L34
db['doc_id']
returns a Document
object, not a JSON, like CouchDB-Python. This means it doesn't throw an exception if the document is missing (because no HTTP request occurs), but matching the CouchDB-Python layout with this would be a one-line change: return self.document(name, **self.opts).get().result().json()
Do you think that would be an improvement?
Anything that prevents devs from rewriting stuff (or at least minimizes the delta as you said) will be a boon to adoption.
The more of that, the betta! :grin:
On Thu Nov 7 14:05:34 2013, Max wrote:
One immediate item that comes to mind is in this line: https://github.com/cloudant-labs/cloudant-python/blob/master/cloudant/database.py#L34
|db['doc_id']| returns a |Document| object, not a JSON, like CouchDB-Python. This means it doesn't throw an exception if the document is missing (because no HTTP request occurs), but matching the CouchDB-Python layout with this would be a one-line change: |return self.document(name, **self.opts).get().result().json()|
Do you think that would be an improvement?
— Reply to this email directly or view it on GitHub https://github.com/cloudant-labs/cloudant-python/issues/16#issuecomment-27995945.
Can this issue be closed? :)
Done :)
couchdb-python has the goods on a "Pythonic" API to CouchDB.
I know such things are subjective/opinionated, but barring that, I find matching this API and pulling in the best bits and opportunity for consensus building and easy switching/upgrading when a user moves to Cloudant (both the service and this Python library).