Re: [Tutor] sort() method and non-ASCII

2017-02-06 Thread Alan Gauld via Tutor
On 06/02/17 12:13, boB Stepp wrote: py> 'pi = \N{GREEK SMALL LETTER PI}' 'pi = π' >>> >>> >>> You have surprised me here by using single quotes to enclose the >>> entire assignment statements. I thought this would throw a syntax >>> error, but it works just like you show. What is going

Re: [Tutor] sort() method and non-ASCII

2017-02-06 Thread boB Stepp
On Sun, Feb 5, 2017 at 10:49 PM, Cameron Simpson wrote: > On 05Feb2017 22:27, boB Stepp wrote: >> >> On Sun, Feb 5, 2017 at 7:23 PM, Steven D'Aprano >> wrote: >>> >>> Alternatively, you can embed it right in the string. For code points >>> between U+ and U+, use the \u escape, and for th

Re: [Tutor] sort() method and non-ASCII

2017-02-05 Thread Cameron Simpson
On 05Feb2017 22:27, boB Stepp wrote: On Sun, Feb 5, 2017 at 7:23 PM, Steven D'Aprano wrote: Alternatively, you can embed it right in the string. For code points between U+ and U+, use the \u escape, and for the rest, use \U escapes: py> 'pi = \u03C0' # requires exactly four hex digit

Re: [Tutor] sort() method and non-ASCII

2017-02-05 Thread boB Stepp
On Sun, Feb 5, 2017 at 7:23 PM, Steven D'Aprano wrote: > On Sun, Feb 05, 2017 at 04:31:43PM -0600, boB Stepp wrote: >> On Sat, Feb 4, 2017 at 10:50 PM, Random832 wrote: >> > On Sat, Feb 4, 2017, at 22:52, boB Stepp wrote: > Alternatively, you can embed it right in the string. For code points >

Re: [Tutor] sort() method and non-ASCII

2017-02-05 Thread boB Stepp
On Sun, Feb 5, 2017 at 5:25 PM, Cameron Simpson wrote: > You might want to drop this term "hexadecimal"; they're just ordinals (plain > old numbers). Though Unicode ordinals are often _written_ in hexadecimal for > compactness and because various character grouping are aligned on ranges > based o

Re: [Tutor] sort() method and non-ASCII

2017-02-05 Thread Steven D'Aprano
On Sun, Feb 05, 2017 at 04:31:43PM -0600, boB Stepp wrote: > On Sat, Feb 4, 2017 at 10:50 PM, Random832 wrote: > > On Sat, Feb 4, 2017, at 22:52, boB Stepp wrote: > >> Does the list sort() method (and other sort methods in Python) just go > >> by the hex value assigned to each symbol to determine

Re: [Tutor] sort() method and non-ASCII

2017-02-05 Thread eryk sun
On Sun, Feb 5, 2017 at 10:30 PM, boB Stepp wrote: > I was looking at http://unicode.org/charts/ Because they called them > charts, so did I. I'm assuming that despite this organization into > charts, each and every character in each chart has its own unique > hexadecimal code to designate each c

Re: [Tutor] sort() method and non-ASCII

2017-02-05 Thread Cameron Simpson
On 05Feb2017 16:31, boB Stepp wrote: On Sat, Feb 4, 2017 at 10:50 PM, Random832 wrote: On Sat, Feb 4, 2017, at 22:52, boB Stepp wrote: Does the list sort() method (and other sort methods in Python) just go by the hex value assigned to each symbol to determine sort order in whichever Unicode e

Re: [Tutor] sort() method and non-ASCII

2017-02-05 Thread boB Stepp
On Sat, Feb 4, 2017 at 10:50 PM, Random832 wrote: > On Sat, Feb 4, 2017, at 22:52, boB Stepp wrote: >> Does the list sort() method (and other sort methods in Python) just go >> by the hex value assigned to each symbol to determine sort order in >> whichever Unicode encoding chart is being implemen

Re: [Tutor] sort() method and non-ASCII

2017-02-05 Thread boB Stepp
On Sun, Feb 5, 2017 at 2:32 AM, Steven D'Aprano wrote: > On Sat, Feb 04, 2017 at 09:52:47PM -0600, boB Stepp wrote: >> Does the list sort() method (and other sort methods in Python) just go >> by the hex value assigned to each symbol to determine sort order in >> whichever Unicode encoding chart i

Re: [Tutor] sort() method and non-ASCII

2017-02-05 Thread Random832
On Sat, Feb 4, 2017, at 22:52, boB Stepp wrote: > Does the list sort() method (and other sort methods in Python) just go > by the hex value assigned to each symbol to determine sort order in > whichever Unicode encoding chart is being implemented? By default. You need key=locale.strxfrm to make it

Re: [Tutor] sort() method and non-ASCII

2017-02-05 Thread Steven D'Aprano
On Sat, Feb 04, 2017 at 09:52:47PM -0600, boB Stepp wrote: > Does the list sort() method (and other sort methods in Python) just go > by the hex value assigned to each symbol to determine sort order in > whichever Unicode encoding chart is being implemented? Correct, except that there is only one

Re: [Tutor] sort() method and non-ASCII

2017-02-04 Thread eryk sun
On Sun, Feb 5, 2017 at 3:52 AM, boB Stepp wrote: > Does the list sort() method (and other sort methods in Python) just go > by the hex value assigned to each symbol to determine sort order in > whichever Unicode encoding chart is being implemented? list.sort uses a less-than comparison. What you

[Tutor] sort() method and non-ASCII

2017-02-04 Thread boB Stepp
Does the list sort() method (and other sort methods in Python) just go by the hex value assigned to each symbol to determine sort order in whichever Unicode encoding chart is being implemented? If yes, then my expectation would be that the French "á" would come after the "z" character. I am not r