Revise search raw - #101
Conversation
a518244 to
64d65bf
Compare
|
I'm surprised I missed that wrong signature for About the I had a stronger reason for having some methods accept (and pass on) In both these issues, I'm fine with either solution. I'm still trying to find out elegant programming patterns that create nice abstractions, allow for easy code reuse and inheritance. |
|
I'm okay with requiring subclasses to implement I understand what you mean about not wanting to have to know what arguments do and don't conflict with Elasticsearch, but I actually lean toward thinking it may be a good thing. It forces a problem when there would otherwise just be an ambiguity. I don't want a situation where the same key as a keyword argument and as a param do different things. This way, we're forced to name our keyword arguments in ways that don't collide with ES features. Is that a reasonable line of thinking? |
In this project I'm totally okay with it too, as it's all simple. I think that in general the gating pattern is a bit nicer. Your suggestion implies one would have to duplicate the Background story is that I more often find that I want to make a slight modification to a library's functions, but end up having to clone large portions of code. Having the freedom to replace subfunctions provides a partial solution to this. It does make that the subfunction (
An issue is that we're not really forced to: one has to manually check the ES API (and watch it for changes), as there will be no warnings on a keyword collision. I'm thinking our language may be to primitive, having keyword arguments in a flat list rather than using some structured approach. Just like variables have namespaces so they don't shadow each other. Anyway, for practical matters, any of our approaches are fine. This conversation is mostly philosophical. I'll let you choose which branch to merge (my branch is also rebased and updated). |
|
I'll give @nickstenning a chance to look. |
|
Sorry folks -- I'll review this tomorrow. Shattered today. |
|
No problem, @nickstenning. Just to clarify, it's between this and #91 with the difference being that this PR removes some kwargs where they weren't used which revealed to me that there were places they were unused that an explicit params argument was used instead. So I killed params in favor of kwargs. Either PR or a combination of the two (kill kwargs where not needed but still use params) is fine with me. |
|
This looks good to me. Honestly, I think I do prefer the use of an explicit parameter rather than keyword arguments to pass params through to the elasticsearch API. It seems less likely to blow up in our faces later on. But, that's something we can do later. This pull request is clear improvement as it is. |
Later? Now is always a good moment. #102 |
@Treora your thoughts, please. I removed the extra commit I caused you to make (sorry, again!) and then I spotted a place where the
Documenttests were using the wrong signature forsearch(). Finally, it seemed likekwargswere being passed around in places where they were discarded or unused andparamsseemed unnecessary if we just use kwargs for that role.Let me know what you think.