[Tutor] Understanding the tutorial
Danny Yoo
dyoo at hkn.eecs.berkeley.edu
Tue Feb 21 22:37:37 CET 2006
> 2.1 Invoking the Interpreter
>
> *******
> is written with the unix programmer in mind.
> I do understand some unix, since I used to work on a unix system. But now
> the only system
> I have available is Microsoft windows.
> In windows I invoke the interpreter by clicking on the Python icon, or by
> selecting from the program list menu.
By the way, if your Windows installation is set up properly, it should
also be possible to invoke Python from the command line by entering in
'python'.
> ******
> 2.1.1 Argument Passing
> *******
> Since I do have some unix experience, I understand the idea of a script
> file but even so, it's not clear what should be in a Python script file.
> Having some sample scripts in hyperlinks would be very useful.
> The sample scripts could illustrate the different options and several simple
> Python commands by
> doing trivial programming tasks like
> Calculating powers of 3,
> Calculating square and square root table
> Sorting list by bubble sort method, etc.
> Then these sample scripts could be referenced throughout the tutorial at the
> relevant places.
Yes. The tutorial does have examples, but the examples could be a bit
more polished. I'm not exactly sure if it's worth it to hyperlink the
examples as separate pages, but I can see it of being of use.
> mode to see what Phython does.
> So far, the interactive mode has been more useful to me than the tutorial.
> Perhaps as I gradually learn the Python philosophy and vocabulary, I'll more
> easily read
> the current tutorial.
> *******
> 2.2.1 Error Handling
> *****
> I skipped over this paragraph since I had not yet encountered any errors
> because I had not yet
> written any programs.
Yes. I think that section on the bottom needs a concrete example of an
error message, at least to give a taste of what is being talked about.
The tutorial talks about errors in more detail in Section 8, so perhaps a
note about this might be appropriate there.
> 2.2.2 Executable Python Scripts
>
> ********
> Is written with unix programmer in mind. I imagine the windows programmer
> should use the dos prompt
> for the equivalent. Or perhaps there is some way to invoke the script from
> the Python shell.
> Examples should be given.
Agreed.
> *********
> 2.2.3 Source Code Encoding
>
> *****
> At this point I just about gave up reading from cover to cover.
Ah! Skip that for now.
The issue it's addressing is one of textual encoding: because Python
lives in a world with different languages, it is no longer valid to always
assume that a text file's in ASCII all the time. Some programs might be
written using the Unicode character set, for example.
Because files don't have metadata associated to them in general, Python
resorts to allowing the first few lines to contain some self-describing
"source encoding" to tell Python what the proper interpretation should be.
These issues are similar to the ones that HTML pages have to deal with
too, so there is some assumed knowledge here in the tutorial. If you are
interested, see:
http://www.joelonsoftware.com/articles/Unicode.html
> Anyway, these are a few comments about the tutorial. I am willing to
> continue with my critique of the tutorial if you wish.
This would be fine; that's what this Python-Tutor list is for, to allow us
programmers to support and teach each other.
> We could have an ongoing dialogue, taking the tutorial one small piece
> at a time. For I do wish to understand all of it, for I wish to write
> other programs in Python, eventually using all the capabilities of
> Python.
I treat the official tutorial as a quick way of seeing many of the
important features in Python, but I don't treat it as comprehensive. It
does gloss over a lot.
But here is a more satisfying tutorial that is also available for free:
http://diveintopython.org/
>From our conversation, I think you will enjoy Dive Into Python a lot more
than the official tutorial; try it out!
More information about the Tutor
mailing list