📝 Python

How Python Strings Actually Work

BLOG ARTICLE Published on January 4, 2026

Written by Samuel Ochaba

Source: DEV Community - Python 1 min read intermediate

Summary

If you write this code: name = "alice" name.upper() print(name) you will get "alice" and NOT "ALICE". This is the first fundamental truth about Python strings: they're immutable. What Immutability Means When you call upper(), Python doesn't reach into memory and change the letters. It can't. String objects, once created, cannot be modified. What upper() actually does is build an entirely new string and return it: >>> s = "hello" >>> result = s.upper...

#python #beginners #programming #performance
0 views
0 likes
0 comments