-
Notifications
You must be signed in to change notification settings - Fork 103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
object wrapper for query includes #3
Comments
I'm not sure how other people have experienced it, but I personally found this particular facet of py-mb2 to be quite cumbersome -- instead of just making a list, I had to construct a special object that had its own separate documentation page. Maybe there's a way this could be more succinct and clear, but I'm not certain making a plethora of special classes for each entity type is the most elegant solution. |
I suppose I like it because it's (relatively) explicit as to what things you're allowed to ask for in a query. Alternate ways of asking for the same information:
|
You're right that the bunch-of-classes approach does make everything very explicit. I'm just not sure if that actually helps programmers (especially in a dynamic language like Python). For example, here's a possible thought process of someone trying to use the library:
At this point, if there's a special class, I still don't know what to do -- I have to look at the documentation for that class, whose constructor eventually just has a bunch of keyword parameters itself (presumably). With "real" keyword arguments or (As an aside, having special objects would probably be the right way to go with a static language -- there, you'd want to get a compile-time error for using the wrong values. But in Python, the error happens at run time anyway.) |
Since the possible includes can be represented in a simple list, we can document these in the docstrings. I would go that way. |
@alastair: close as this isn't something that will happen? |
Python-musicbrainz2 has classes for encapsulating what entities to include with a query, e.g. http://users.musicbrainz.org/~matt/python-musicbrainz2/html/musicbrainz2.webservice.TrackIncludes-class.html
We could consider having the same for queries
The text was updated successfully, but these errors were encountered: