[issue39132] Adding funcitonality to determine if a constant string node is triple quoted

Serhiy Storchaka report at bugs.python.org
Thu Dec 26 02:03:29 EST 2019


Serhiy Storchaka <storchaka+cpython at gmail.com> added the comment:

It is impossible because of using newline escaping and string literal concatenation. In the following examples 
lineno != end_lineno, but strings use single quotes:

    print('Hello '
          'world!')

    print('Hello\
 world!')

Triple quotes can be also used for strings which occupy a single line of code and do not contain \n:

    print("""exec("print('Hi!')")""")

We cannot also distinguish 1234 from 0x4_d2 and 1234.0 from 1.234e3 at the AST level.

----------
nosy: +serhiy.storchaka

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


More information about the Python-bugs-list mailing list