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})
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}'
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)