[issue28657] cmd.Cmd.get_help() implementation can't see do_*() methods added dynamically by setattr()

Błażej Michalik report at bugs.python.org
Mon Jul 9 05:20:50 EDT 2018


Błażej Michalik <assassinking at gmail.com> added the comment:

It seems to me as if the current implementation forces the user to violate SRP, but I'm not going to argue about that. I don't feel equipped well enough to judge.

> Could this have been done with:  setattr(self.__class__, "do_" + command, func)?

Isn't that worse than doing that on an instance? It will work as long as there's only one.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue28657>
_______________________________________


More information about the Python-bugs-list mailing list