classification
Title: Format string does not work with "in" statement
Type: Stage: resolved
Components: 2to3 (2.x to 3.x conversion tool) Versions: Python 3.7
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: ramon.rnm@gmail.com
Priority: normal Keywords:

Created on 2019-12-16 12:27 by ramon.rnm@gmail.com, last changed 2019-12-16 12:30 by ramon.rnm@gmail.com. This issue is now closed.

Messages (1)
msg358479 - (view) Author: Ramon Medeiros (ramon.rnm@gmail.com) Date: 2019-12-16 12:27
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
History
Date User Action Args
2019-12-16 12:30:32ramon.rnm@gmail.comsetstatus: open -> closed
resolution: not a bug
stage: resolved
2019-12-16 12:27:44ramon.rnm@gmail.comcreate