Strange strxfrm behaviour?
Tomaž Ficko
tomaz at gmx.net
Fri Oct 11 18:19:29 EDT 2002
Is this normal strxfrm behaviour? Shouldn't strxfrm return the same result
for same agrument everytime it's called.
Python 2.2.1 (#1, May 26 2002, 17:29:37)
[GCC 2.95.3 20010315 (SuSE)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import locale
>>> locale.setlocale(locale.LC_ALL, "")
'sl_SI.ISO-8859-2'
>>> s = 'a'
>>> d = {}
>>> for i in range(1000):
... sf = locale.strxfrm(s)
... if d.has_key(sf):
... d[sf] += 1
... else:
... d[sf] = 1
...
>>> print d
{'\r\x01\x02\x01\x02\x01\x1f\x08\x10': 144,
'\r\x01\x02\x01\x02\x01\x1d\x08\x10': 155,
'\r\x01\x02\x01\x02\x01\x1b\x08\x10': 94,
'\r\x01\x02\x01\x02\x01\x12\x08\x10': 9,
'\r\x01\x02\x01\x02\x01\x19\x08\x10': 104, '\r\x01\x02\x01\x02\x01
\x08\x10': 59, '\r\x01\x02\x01\x02\x01\x1e\x08\x10': 135,
'\r\x01\x02\x01\x02\x01\x1c\x08\x10': 113,
'\r\x01\x02\x01\x02\x01\x1a\x08\x10': 111,
'\r\x01\x02\x01\x02\x01\x18\x08\x10': 76}
What is going on here. Any hints?
Thanks
Tomaž
More information about the Python-list
mailing list