TechToFreedom
Published in

TechToFreedom

String Interning in Python: A Hidden Gem That Makes Your Code Faster

Level up the speed of string comparisons

String Interning in Python: A Hidden Gem That Makes Your Code Faster
Photo by wu yi on Unsplash

The string interning is a very helpful mechanism in Python to make string comparisons much faster. Unfortunately, how it works and how to use it properly are not very intuitive for beginners. If we don’t understand it, sometimes we could be confused about some unexpected results.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store