[docs] [issue29947] In SocketServer, why not passing a factory instance for the RequestHandlerClass instead of the class itself?

Martin Panter report at bugs.python.org
Sun Apr 2 01:44:07 EDT 2017


Martin Panter added the comment:

By “factory instance”, I presume you just mean a function (or class or method) that returns an appropriate object when called. (I think these are normally called “factory functions”. Instances are objects, the things that class constructors and factories return.)

What is being proposed? The best idea that I understand is hinted in <https://bugs.python.org/issue29947#msg290976>. That is, to document and allow any function (not just a class or factory) to be passed as (or instead of) the RequestHandlerClass parameter.

This is a significant change to the documentation and API, but I would support it, and I think it should already be supported by the implementation.

The question of renaming the RequestHandlerClass parameter is a harder decision IMO. I think it would be easier to make the documentation clear that it is a misnomer and does not have to be a class. But in the long term, renaming the parameter seems nicer.

If it was “renamed”, we would first have to add a competing parameter, keep the old parameter around, consider adding deprecation warnings in 2020 when Python 2 is dead, document both parameters, decide if anything should happen when both parameters are passed, etc. Much trickier, but possible. This renaming process is similar to “base64.encodestring” vs “encodebytes”, but more involved. I can’t think of an example where a function or constructor parameter was renamed like this.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue29947>
_______________________________________


More information about the docs mailing list