On Thu, 04 Apr 2013 01:17:28 +1100, Chris Angelico wrote: > Probably, but it still has to scan the body of the string. It'd not be > too bad if it's all astral, but if it's all BMP, it has to scan the > whole string. In the max() case, it has to scan the whole string anyway, > as there's no other way to determine the maximum. I'm thinking here of > this function: > > http://pike.lysator.liu.se/generated/manual/modref/ex/7.2_3A_3A/String/ width.html > > It's implemented as a simple lookup into the header. (Pike strings, like > PEP 393 strings, are stored in the most compact way possible - 1, 2, or > 4 bytes per character - with a conceptually similar header structure.) > Is this something that would be worth having available? Should I post an > issue about it?
I'm not really sure why I would want to know, apart from pure intellectual curiosity, but sure, post a feature request. Be sure to mention that Pike supports this feature. -- Steven -- http://mail.python.org/mailman/listinfo/python-list