2 ms·
>Actually, you can in Python You are right (apart from combining characters as masklinn explained), but as I said, that's only possible if an array of 32 bit i
by fauigerzigerk 13y ago
>Actually, you can in Python
You are right (apart from combining characters as masklinn explained), but as I said, that's only possible if an array of 32 bit ints is used to hold string data or if it can be guaranteed that there are no characters from outside ASCII or BMP. If I understand PEP 393 correctly, what Python 3.3 does is to use 32 bit ints to hold the entire string if even one such code point occurs. So if you load a (possibly large) text file into a string and one such code point exists then the file's size is going to quadruple in memory. All of that is done just to implement one very rare operation efficiently.
http://www.python.org/dev/peps/pep-0393/#new-api http://www.python.org/dev/peps/pep-0393/#new-api