Skip Navigation
General Programming Discussion @lemmy.ml

How does Python 3.10's string work?

I don't know how Python 3.10's string works internally. Is it choosing between 8-bit, 16-bit, and 32-bit per character in runtime?

For example:

 Python
    
for line in open('read1.py'):
    print(line)


  

Can the line string be an 8-bit, 16-bit, or 32-bit character string in each iteration? Should the line be 8-bit by default and become a 32-bit string if that line has an emoji?

Comments

2