Screenshot instructions:
Windows
Mac
Red Hat Linux
Ubuntu
Click URL instructions:
Right-click on ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)
From: Serge Noiraud <Serge.Noiraud@fr...> - 2009-04-18 15:32:31
|
Peter Landgren a écrit : > Hi, > > Need some hint to understand sorting i python. > > Example see: > > http://www.gramps-project.org/bugs/view.php?id=2933 > > As can be seen surnames beginning with V and W are sorted "together!", > not as separate. > > If I change the sort method from xxx.sort(locale.strcoll) to just > xxx.sort() I get V and W sorted separate, but of course names beginning > with non ascii letters fail. I think the difference is the following : The sort function without argument use the C locale for sorting. In this case, the C collating sequence is the ASCII sequence, so the "V" and "W" characters are differents. When you use the argument, you use your locale ( LC_* and LANG environment variables ) At the prompt, the locale command gives you your environment for that. In this case, depending on that, you can have "V" and "W" the same for sorting. This is not python the problem, but the collating sequence depending on your locale. In your case, the "V" and "W" are similar for your locale. > > Why is V and W treated differently in the two sort methods? > > I have seen this problem not only in Narr Web Rep, but also in the place > view. > > Note I'm using Swedish locale. How does it work with other locales? > > /Peter |