pyminifier icon indicating copy to clipboard operation
pyminifier copied to clipboard

Does not support Python 3.6 f'{string}'

Open chumaumenze opened this issue 7 years ago • 3 comments

The minifier does not support python 3.6 f-string.

Sample.py

name : str = 'Chuma' 
print(f'Hello {name}!')

Minified.py

k=str
t=print
u:k='Chuma'
t(f'Hello {name}!')

It doesn't change the variable name within the f-string causing a NameError whenever executed.

chumaumenze avatar Apr 23 '18 14:04 chumaumenze

I also does not support '{hi}'.format(hi=hello)

chumaumenze avatar Apr 23 '18 14:04 chumaumenze

I use f-strings a lot (because .format() so sooooo ugly). Is this issue on the radar for a fix anytime soon?

I'm guessing not since the last commit was 26-Jun-2015 :(

BrendanSimon avatar Nov 07 '18 02:11 BrendanSimon

This issue has "fixed itself" as of Python 3.12 thanks to changes to how the tokenizer treats f-strings. For more information, see https://peps.python.org/pep-0701/.

JamesGuthrie avatar Jan 03 '24 20:01 JamesGuthrie