STINNER Victor added the comment: Serhiy: "It looks to me that this optimization was added to avoid spending executing time for docstrings. Other cases almost never occur in real code and are not worth to be optimized. But the patch makes the code cleaner (it would even more cleaner if collapse all kinds of constants in Constant)."
Oh, I don't really care of performance. The bytecode just doesn't make any sense to me. I don't understand why we load a constant. Maybe the compiler should emit a warning to say that the code doesn't make sense at all and is ignored? Example with GCC: $ cat x.c int main() { 1; } $ gcc x.c -Wall -o x x.c: In function 'main': x.c:3:5: warning: statement with no effect [-Wunused-value] 1; ^ ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26204> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com