Serhiy Storchaka <storchaka+cpyt...@gmail.com> added the comment:
I think it is for historical reasons. Currently statements consisting of a constant expression are not compiled to a bytecode and do not add a value to co_consts. But when this optimization was not yet added, the first element of co_consts with a docstring was a docstring. So why add co_doc if the docstring is already available? This can be changed, but this is a breaking change, and what we will got instead? Function's __name__ is set from code object's co_name. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue36521> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com