DEV Community

Cover image for One annoying difference between python versions 3.5 and 3.6
Matt Ellen-Tsivintzeli
Matt Ellen-Tsivintzeli

Posted on

One annoying difference between python versions 3.5 and 3.6

Back in the ancient time, the olden days, all the way back in March of 2019, there was python 3.5.7.

Back in those days there were no f-strings. No, if you wanted to interpolate your variables into a string the closest you could get to f-strings was this:

circumference = 19
radius = circumference/math.pi/2
area = math.pi*radius*radius
circledata = 'circumference: {circumference}, radius: {radius}, area: {area}'.format(**{'circumference':circumference, 'radius':radius, 'area':area})
Enter fullscreen mode Exit fullscreen mode

Behold the abomination! What a mess.

Now? Oh now! What a wonder that has been bestowed upon us. THE F-STRING. Behold!

circumference = 19
radius = circumference/math.pi/2
area = math.pi*radius*radius
circledata = f'circumference: {circumference}, radius: {radius}, area: {area}'
Enter fullscreen mode Exit fullscreen mode

Succinct and marvellous.

Why should I bring this up? Well, upon mine laptop I am blessèd with python 3.7. Yet. YET! My raspberry pi suffers in the gutter, hope lies dashed upon the pavement, with python 3.5.

Top comments (0)