Hi Spencer, thanks for the proposal.
My main question is what happens if the URI already has a query. Do we update it? Do we replace it? On this question alone, if we were to add such functionality, then I think it should not be called encode_query but rather update_query/replace_query.
update_query itself has ambiguous connotations as well, in that it can either update_query (replacing duplicate keys) or simply append to it since a query can have duplicate keys (so maybe it should be called append_query?). Note how a web server will handle duplicate keys is completely up to the web server implementation, so having an implementation that appends by default can lead to surprising behaviour.
The implementation of the PR follows the append_query semantics - but we need to discuss all of those things if we are to accept such a proposal because these semantics need to make sense in the general case.
The other thing to note is that "URI.encode_query" is one of many ways of encoding a query string. Web applications have historically built more complex query encoding/decoding schemas that (poorly) support richer data structure, so this API may not be enough depending on what you want to encode.