Experiences/guidance on teaching Python as a first programming language

Ned Batchelder ned at nedbatchelder.com
Thu Dec 12 08:52:21 EST 2013


On 12/12/13 4:17 AM, wxjmfauth at gmail.com wrote:
> Le mercredi 11 décembre 2013 11:45:43 UTC+1, Chris Angelico a écrit :
>> On Wed, Dec 11, 2013 at 7:43 PM, Chris Angelico <rosuav at gmail.com> wrote:
>>
>>> When you tell a story, it's important to engage the reader from the
>>
>>> start.
>>
>>
>>
>> On Wed, Dec 11, 2013 at 8:39 PM,  <wxjmfauth at gmail.com> wrote:
>>
>>> A few practical considerations, far away from theoretical
>>
>>> aspects. Mainly for non ascii, understand non native English
>>
>>> speakers.
>>
>>
>>
>> And then, shortly after the beginning of the story, you need to
>>
>> introduce the villain. Thanks, jmf, for taking that position in our
>>
>> role-play storytelling scenario! A round of applause for jmf, folks,
>>
>> for doing a brilliant impression of the uninformed-yet-fanatical
>>
>> Knight Templar villain!
>>
>
> I know Python since ver. 1.5.6 and used it intensively
> since ver. 2.0 or 2.1 (?). I acquired some user experience.
>
> Windows, Py2.(7), ascii. It is not a secret Python uses
> ascii for the representation.

It is incorrect that Py2.x uses ASCII strings.  It uses byte strings. 
Source files are assumed to be encoded in ASCII, so byte strings often 
are ASCII.  But as Chris has pointed out, bytestrings can hold any byte 
data, including UTF-8 if you wish.

JMF, I think you are clever enough and care enough about these issues to 
get this straight.

Many people seem to like the Pragmatic Unicode presentation I did, it 
may clear up some issues:  http://nedbatchelder.com/text/unipain.html

I'd be glad to have an extended conversation with you offline if you 
don't want to get into details here.

> As an example, this guy
> who some time ago exposed his own solution to solve that
> problem (btw, elegant and correct). ---  you wrote blah, blah
> about his "mysterious code point", you did not recognize
> he is (was) using Turkish Windows with the code
> page cp1254 ---. It is a little bit fascinating, 20 years
> after the creation a language, people are still fighting
> to write text in a human way.

"This guy": I have no idea who you are talking about.

>
> Unicode. For a first language, it may be not a bad idea
> to use a language which uses "unicode à la unicode".
>
> Windows, Py3, unicode. It is is infortunate, but it is
> a fact Python has some problems with that platform (file
> sytem encoding), -> potential problems which should not
> exist for a beginner.

File system encodings are very difficult.  Linux uses byte strings for 
file names, with no attempt to record the encoding, so there's a strong 
possibility that the declared encoding for the filesystem is wrong, or 
that your guess at the encoding will be wrong.

> I am the first to recognize the win console is all but
> friendly. If one wishes to use a unicode code page, Python
> fails [*].

Yes, the Windows console and Python don't get along well with Unicode. 
This is a long-standing ticket: http://bugs.python.org/issue1602  I'm 
sure they would welcome your contribution towards a solution.  When I 
use Windows, I often wish this were solved.

>
> Python has plenty of good qualities, you (and others)
> are discussing plenty of theoretical aspects.
> I'm pointing the fact, one may be stuck simply because
> one cannot display a piece of of text!
> I'm not so sure, such a behaviour is expected from a
> beginner learning a computer language.
>
>
> [*] I toyed with go(lang) and ruby 2 (only in a unicode
> perspective), I should say I had no problems. Why? No
> idea, it is too far beyond my knowlege.
>
> jmf
>
>


-- 
Ned Batchelder, http://nedbatchelder.com




More information about the Python-list mailing list