[Tutor] sort() method and non-ASCII

Alan Gauld alan.gauld at yahoo.co.uk
Mon Feb 6 14:39:48 EST 2017


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 on here?

> I just came out of the shower this morning thinking, "Stupid boB,
> stupid.  That's just an escape sequence inside an overall string, not
> an assignment statement."  Duh!  My brain works better asleep than
> awake...

To be fair it did look like an assignment so when I first
saw it I too went "huh?!". But then I looked again and
figured it out. :-)

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos




More information about the Tutor mailing list