New submission from INADA Naoki: spin off of #11549.
http://bugs.python.org/issue11549#msg130955 > b) Docstring is now an attribute of Module, FunctionDef and ClassDef, > > rather than a first statement. Docstring is a special syntactic > construction, it's not an executable code, so it makes sense to separate it. > Otherwise, optimizer would have to take extra care not to introduce, change > or remove docstring. For example: > > def foo(): > "doc" + "string" > >Without optimizations foo doesn't have a docstring. After folding, however, >the first statement in foo is a string literal. This means that docstring >depends on the level of optimizations. Making it an attribute avoids the >problem. ---------- files: ast-docstring.patch keywords: patch messages: 287136 nosy: haypo, inada.naoki priority: normal severity: normal status: open title: Change docstring to attribute from first statement. versions: Python 3.7 Added file: http://bugs.python.org/file46543/ast-docstring.patch _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue29463> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com