[Tutor] Beginning Python and other resources (was Re: Slicing Tuples)

David bouncingcats at gmail.com
Sun Dec 12 00:47:05 CET 2010


On 12 December 2010 03:25, John Russell <thor at othala.us> wrote:
> Last night I started working through a book (Beginning Python: Using Python
> 2.6 and Python 3.1)  I bought to learn Python, and there is an example in it
> that doesn't make sense to me.

I have that book too, and several others thankfully. I'm just writing
to share my experience, in case another perspective from another
relatively new python user is helpful to anyone.

I found that book is written towards a friendly beginner level, but it
omits many details and is not a comprehensive reference. It does
include plenty of examples on many topics. I have read the opposite
criticism of other books, so it is probably impossible for one book to
fit all needs.

Personally I became weary of the food/fridge/kitchen theme of the
early examples as it did not engage my interest at all, and there is
so much of it. However I have found that book valuable for its Part
III where it covers useful applications. Although I have come to
expect that its examples will often need typos corrected or other
small modifications to get them to run properly on Python 2.6.

So while working through Parts I and II, if your experience is
anything like mine where I moved away from it fairly quickly, you will
definitely need other resources. Fortunately they are abundantly
available. In case you are unaware, a Tutorial and Reference are
integrated with Python. On my Linux box the tutorial is
file:///usr/share/doc/python-docs-x.x.x/html/tutorial/index.html and
the Alphabetic Index to the Reference is
file:///usr/share/doc/python-docs-x.x.x/html/genindex.html

I find the Tutorial easily readable, whereas the Reference can be
challenging, but it is comprehensive and likely contains the answer to
most questions, somewhere.

As an exercise I thought I'd try to find the answer to your question
using these built-in docs. The keyword is "slice" which we know from
the book. I couldn't find any coverage in the 2.6 tutorial so I looked
up "slice" in the Alphabetic Index, and the first link took me to a
section which includes the answer: "The slicing now selects all items
with index k such that i <= k < j where i and j are the specified
lower and upper bounds".

In case you are not aware, the web has a vast amount of great material
for learning Python, see for example:
http://wiki.python.org/moin/BeginnersGuide/NonProgrammers
As Python is an evolving language, one needs be mindful of the
differences between Python 2.x and Python 3.x when using this
material.

My favourite Python book of my small beginners collection is "Python 3
Object Oriented Programming" by Dusty Phillips. It claims:
"If you're new to object-oriented programming techniques, or if you
have basic Python skills, and wish to learn in depth how and when to
correctly apply object-oriented programming in Python, this is the
book for you".
I endorse that completely. Having learned the syntax basics elsewhere,
for me this is a book like no other. I find its topic coverage and all
its short examples consistently useful, powerful, and illuminating. I
find it easy to read, well matched to my level and interest, and it
has made a real difference to the code I write. I use classes with
confidence now. For example, it gave me the background and confidence
to design a custom sortable abstract class I needed, my first personal
experience of the power of OOP.

Tthe python and tutorial mailing lists are a wonderul resource as you
are obviously aware. Thanks to all the contributors from whom I
continue to learn.


More information about the Tutor mailing list