[issue39063] Format string does not work with "in" statement

Ramon Medeiros report at bugs.python.org
Mon Dec 16 07:27:44 EST 2019


New submission from Ramon  Medeiros <ramon.rnm at gmail.com>:

Tried to use "in" statement to check if a string exists in a array and failed using string format.

How to reproduce:

~/ ipython
Python 3.7.4 (default, Oct 12 2019, 18:55:28)
Type 'copyright', 'credits' or 'license' for more information
IPython 7.8.0 -- An enhanced Interactive Python. Type '?' for help.

In [2]: "a" in ["a", "b"]
Out[2]: True

In [4]: z = "a"

In [5]: f"{z}" in ["a", "b"]
Out[5]: True

In [6]: z = "b"

In [7]: f"{z}" in ["a", "b"]
Out[7]: True

----------
components: 2to3 (2.x to 3.x conversion tool)
messages: 358479
nosy: ramon.rnm at gmail.com
priority: normal
severity: normal
status: open
title: Format string does not work with "in" statement
versions: Python 3.7

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


More information about the Python-bugs-list mailing list