S
Steven D'Aprano
What it boils down to is:
- it can easily be done by hand now
For some definition of "easily".
if implementation == "CPython":
if version < "3.3":
if sys.maxunicode exists:
use it to decide whether this is a wide or narrow build
if a wide build: return 4
else: return 2
else:
???
elif version == "3.3":
scan the string, in some efficient or inefficient way
return 1, 2, 4 depending on the largest character you find
else:
???
else:
???
- it's a very uncommon need
Well, that at least is true. But then, needing to know the platform
you're running under, the size of objects, the id of a object, the
largest integer, the largest float, or the number of references seen by
the garbage collector are also uncommon needs. What really matters is not
how often you need it, but what you can do when you need it if you don't
have it.