Experiences/guidance on teaching Python as a first programming language
wxjmfauth at gmail.com
wxjmfauth at gmail.com
Thu Dec 12 11:20:45 EST 2013
Le jeudi 12 décembre 2013 15:47:40 UTC+1, Chris Angelico a écrit :
> On Fri, Dec 13, 2013 at 1:34 AM, <wxjmfauth at gmail.com> wrote:
>
> > Le jeudi 12 décembre 2013 11:28:35 UTC+1, Chris Angelico a écrit :
>
> >> On Thu, Dec 12, 2013 at 8:17 PM, <wxjmfauth at gmail.com> wrote:
>
> >>
>
> >> > Windows, Py2.(7), ascii. It is not a secret Python uses
>
> >> > ascii for the representation.
>
> >>
>
> >> Actually no, it doesn't.
>
> >
>
> >>>> sys.version
>
> > '2.7.6 (default, Nov 10 2013, 19:24:18) [MSC v.1500 32 bit (Intel)]'
>
> >>>> sys.stdout.encoding
>
> > 'cp1252'
>
>
>
> What has this to do with ASCII or with Python's internal
>
> representation? All you've proven is that you can convert the repr of
>
> a string back into a byte-string, by replacing "\\xa9" with "\xa9",
>
> and then shown that you can successfully render that as CP-1252 and it
>
> displays as a copyright symbol. Meanwhile when I try the same thing on
>
> my Windows box, the default encoding is cp437, so it throws. Proves
>
> nothing about ASCII, as neither of those encodings is ASCII, and A9
>
> does not decode as ASCII.
>
>
Are you understanding Python by chance? print, __repr__, __str__,
sys.std*.encoding, ...
Are you understanding Windows? CHCP
Are you understanding the coding of the characters? cp1252, cp850, cp437, ...
Python (2) is managing all this very well. Unfortunately, not in
a friendly way.
jmf
More information about the Python-list
mailing list