Błażej Michalik <assassink...@gmail.com> added the comment: Sorry for not describing this one particularly well.
There is nothing wrong with setattr() here, that wasn't the point. Given the code below (py3, lambdas used for brevity): # coding: utf-8 from cmd import Cmd class MyCmd(Cmd): def do_documented_at_definition(self): """ This one is documented with docstring. """ pass def do_documented_afterwards(self): _ = 'This one will be documented afterwards, with help_<...>() method.' cli = MyCmd() cli.do_new_command = lambda *_: print("I'm new here") cli.help_documented_afterwards = lambda *_: print("I'm documenting") cli.cmdloop() 1. When one types in "help": 1.1 there is no mention of "new_command" in the output, even though the command works. 1.2 "documented_afterwards" command is being presented as having no documentation at all, but after typing "help documented_afterwards", it turns out that it is not the case. 2. There is no completion for "new_command", i.e. typing in "new_" and pressing tab key will not make it complete to "new_command". I don't remember what was the use-case for this at the time (probably had something to do with disabling / enabling certain commands at runtime), but the implementation seemed trivial enough that we couldn't see justification for not doing it this way, hence the report. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue28657> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com