dont laugh

Ian Hobson ian.hobson at ntlworld.com
Mon Sep 4 06:53:12 EDT 2000


In article <8or1nt02i7r at news2.newsguy.com>, Alex Martelli
<aleaxit at yahoo.com> writes
>"Ian Hobson" <ian.hobson at ntlworld.com> wrote in message
>news:1rAlZGAgEEs5Ew4l at ntlworld.com...
>    [snip]
>> Python MUST run "out of the box" (even on win32 - which it does not) and
>> then the ideas can be explained.
>
>What do you mean by "it does not"?  You download a self-installing
>executable, run it, and there's a 'Python' entry on the Programs menu
>of your Start button (plus, probably, one or more other entry points,
>such as IDLE and/or Pythonwin, depending on the contents of said
>self-installing executable).  That seems to be pretty much "out of
>the box" to me.
The path initialisation is missing. 

>
>
>> I'm now past my first python prog. The MAJOR hurdles that I have crossed
>> include
>>
>> a) Understanding that "Name error" meant I had forgotten an import line.
>
>That's not something that would be necessarily any easier for the
>interpreter to figure out for you.  Say you use a name it doesn't
>know, such as 'foo'; how could it tell whether
>a) it's a typo for some name it does know, such as 'food'
>b) you forgot to "from bar import foo"
>c) you forgot to "import foo"
>d) you forgot to say "foo=23" earlier
>e) you forgot case matters, and mean 'Foo' or 'FOO'
>or other causes yet?  "Name error" seems appropriately generic for
>an error which could be due to so many disparate causes.
>
Name "foo" not found  

 would do less to confuse: it reports the truth, and does not confuse
the reader with all the other possibilities of name errors such as using
an improper character, conflicting with a keyword, conflicting with an
imported name. (I have even had similar errors because the editor left a
formatting character in the source and then hid it from view!)

>
>> b) Understanding that syntax error meant I had missed a :
>
>Here, I guess, the compiler _could_ be more helpful, specifically
>mentioning the missing colon.
>
>>>> if 1>2
>Traceback (  File "<interactive input>", line 1
>    if 1>2
>          ^
>SyntaxError: invalid syntax
>>>>
>
>The compiler does know what it's expecting, in this case, so
>it could be more helpful about why that syntax is invalid.
>
>
>> c) Getting the resulting program to run from the start menu!
>
>I guess that's not something the typical newbie would attempt;
>those who do want it may know it's just an issue of setting a
>shortcut appropriately (e.g., right-button/Explore on the Start
>menu, navigate to the apropriate subfolder, right-button/New/
>Shortcut, enter the commandline you desire, possibly edit the
>Properties of the resulting shortcut; strictly an issue of Windows
>GUI). 
Don't forget to set the associations and the paths. 

> Do you think automating these tasks would greatly
>enhance Python's accessibility for newbies?  I'm dubious, since
>no major programming environment I know of for Windows
>does it, not even Visual Basic I believe...

Enhance yes. Greatly - perhaps no. 

Most systems produce .exe files, which can be handled in a standard way. 

If you want to run a script on *nix the first line of the script has to
be some magic incantation, AND you must chmod the file. Finding that one
is necessary is relatively easy. Finding both are usually requires a
tame guru. And if you are not near such a guru.......

In the same way, setting the associations so the .py files invoke the
interpreter is easy - once you know which of those executables is the
interpreter. I found that by trial and error. 

But if you put 20 small hurdles in some ones way, they will say sodit
and do something that is more fun.

Ian Hobson 

Every time we teach a child something, we prevent him from inventing 
it himself. - Jean Piaget



More information about the Python-list mailing list