[Tutor] print "Hello, World!"
Steven D'Aprano
steve at pearwood.info
Fri Feb 4 01:57:21 CET 2011
Doug Marvel wrote:
[...]
> I am hoping for a link to a somewhat comprehensive online resource
> that explains from the beginning in English, plain English, as this is
> the only language I speak. Something to get my foot in the door would
> be awesome.
Another very important resource to use is the Python source code. As
they say, "Use the Source, Luke!".
The source code for the Python compiler itself is written in C, but
Python comes with many standard library modules written in pure Python.
They vary in size, complexity and clarity. Not all of them are "best
practice", but none of them are truly bad.
Under Linux, you can find the source code (usually) somewhere like this:
/usr/lib/python2.5/
/usr/local/lib/python3.1/
You can find out where the source code lives this way:
>>> import calendar
>>> calendar.__file__
'/usr/local/lib/python3.1/calendar.py'
or just use your operating system's Find Files utility to search for the
file.
Don't be concerned if some modules go completely over your head. They
haven't been written for beginners. Nevertheless, they are a great way
to see good quality Python code in action. If nothing else, you can read
the comments and docstrings.
However, let me give you a warning... unless you are an expert, it is
*vital* that you treat these files as READ ONLY. If you start changing
the files, you will confuse yourself greatly when things start
mysteriously breaking, and everyone else says "It works for me when I
try it".
(Actually, even as an expert, you should be very wary about changing the
standard library. If you do, it won't be *standard* any more, will it?)
--
Steven
More information about the Tutor
mailing list