This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: '''"""''' != '""""'
Type: behavior Stage: resolved
Components: Interpreter Core Versions: Python 3.6
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: andreas-zeller, eryksun
Priority: normal Keywords:

Created on 2021-01-09 18:40 by andreas-zeller, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (2)
msg384736 - (view) Author: Andreas Zeller (andreas-zeller) Date: 2021-01-09 18:40
The following line of code fails in Python 3.6, which I find surprising.

>>> assert '''"""''' == '""""'  # Fails

Note that the following all pass as expected:

>>> assert """'''""" == "'''"  # Passes
>>> assert '''""''' == '""'  # Passes
msg384739 - (view) Author: Eryk Sun (eryksun) * (Python triager) Date: 2021-01-09 19:20
> assert '''"""''' == '""""'  # Fails

The left-hand side is a triple-quote string literal [1][2] that contains 3 double-quote characters. The right-hand side is a single-quote string literal that contains 4 double-quote characters. Use the interactive shell to check the values. For example:

    >>> list('''"""''')
    ['"', '"', '"']

    >>> list('""""')
    ['"', '"', '"', '"']

If you have difficulty understanding an aspect of the language syntax, please ask a question in an appropriate forum such as python-tutor, python-list, or Stack Overflow.

---

[1] https://docs.python.org/3/reference/lexical_analysis.html#string-and-bytes-literals
[2] https://docs.python.org/3/tutorial/introduction.html#strings
History
Date User Action Args
2022-04-11 14:59:40adminsetgithub: 87042
2021-01-09 19:20:54eryksunsetstatus: open -> closed

nosy: + eryksun
messages: + msg384739

resolution: not a bug
stage: resolved
2021-01-09 18:40:48andreas-zellercreate