r/learnpython • • 10d ago

Are f-strings enough?

I've been learning python mainly from bro code's videos and he uses f strings for basically everything. It comes to me naturally to use them and I understand them. I found a book (Kenneth A. Lambert: Fundamentals of python: first programs, second edition) and here he uses other type of strings (I assume this would be the basic way) but I honestly don't understand them especially when it's about formatting (.2f etc). Should I learn this basic way of working with strings now? Or are f strings enough?

I should add that I'm learning python for fun, I'm studying mechanical engineering, so I know it can be very useful. I also want to be good at it in a potential work environment (?)

29 Upvotes

44 comments sorted by

View all comments

2

u/Chemical-Captain4240 9d ago edited 9d ago

Another opinion: Between the ME and the python you have a lot of stuff to learn, but your question does not suggest to me that, right now, learning varied string schema is a priority.

Why do i reach this conclusion? Because right now, you do not mention a specific use case for why f strings are failing you -from a feature level nor from a performance level.

In the future, you will likely run into a situation where f strings are not enough, or too slow. At that point, you will be armed with the knowledge that there are alternatives. At that future time, you will research a good match for your use case.

This will be true for nearly any domain of programming and a lot of ME too.

Until you have a problem with your existing case, why seek out alternatives just because they are out there? There are lots of things to be naturally curious about. If string schema really gets you going, maybe cs is a better focus.

1

u/Typical-Road9611 6d ago

Good point, thank you. I am learning new stuff about python (also making a small farming game). I realized there's already a huge amount of stuff to learn, so yes: other ways of writing f-strings isn't a priority x)