'Is it possible to use self-documenting f-strings in python 3.7?

As of version 3.8 python offers the possibility of using what is called self-documenting f-strings:

user = 'eric_idle'
member_since = date(1975, 7, 31)
f'{user=} {member_since=}'
"user='eric_idle' member_since=datetime.date(1975, 7, 31)"

My question here is simple: is it possible to import this from future and use it in python 3.7?



Solution 1:[1]

Unfortunately, a language feature like this is unlikely to be supported in previous versions.

Furthermore, it isn't mentioned on __future__'s docs.

Solution 2:[2]

In my experience, it is crucial to include this line in .gitignore

# eslint cache
.eslintcache

in addition to /node_modules (as mentioned by others). This prevents the *.pack cache files from being pushed which are very very large (at least in my case). This solved my problem. I hope it will be of help to others.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Mateen Ulhaq
Solution 2