[Tutor] Study Tips

boB Stepp robertvstepp at gmail.com
Mon May 30 15:02:42 EDT 2016


Hi and welcome to Tutor, Steve!  I am one of the learners, and I can
honestly say that you have found the right place to ask questions when
you get stuck.  Things on the list seem slow this weekend.  In the US,
where I am at, we are having Memorial Day weekend.  I still have to
chew over two meaty answers to questions I asked this weekend from two
resident Pythonistas, Peter Otten and Alan Gauld (Who is also one of
the list's moderators.), but I can't quite get out of holiday mode!
As a way out of learning about decorators, particularly property ones
(Which Peter used in his illustrative code.), I now will post a
lengthy response to your question(s), including some general stuff you
were not asking about that I think you might find helpful.

On Mon, May 30, 2016 at 12:45 AM, Steve Lett <steve.lett777 at gmail.com> wrote:

> I have a slight learning difficulty. Has anyone got any tips on how to
> study programming and what approach would be best for me?

First, I would like to mention some things I have observed that tend
to trip up newcomers to programming and especially in using this
mailing list.  When you successfully subscribed to Tutor, you should
have received a welcome email which attempted to explain some of the
rules this list follows.  If I recall correctly, it even contains a
link to a web page that explains how to ask intelligent questions on
technical mailing lists (Like this one.).  If you vary from this
practice, then you will probably be given that link again
(http://sscce.org/).  If you have not read it, please do.  It is quite
helpful, not just for you, but for those who *do* wish to help you.

For instance, I trimmed your post down to what I am going to try to
respond to, but I fear I may run on a bit.

The most basic thing is to always respond to the whole Tutor list, not
just to the person who posts a response to your email.  Tutor is a
collaborative learning environment.  Answers to your questions could
easily prove helpful to me and others.  Also, by posting to the entire
Tutor list, you ensure to get a variety of perspectives on your
issue(s).

I notice you have a Gmail address.  If you are using the Gmail email
program, too, then you need to make sure that ALL of your emails and
responses to Tutor are in plain text with no attachments.  If you
don't do this, you will have problems.  The main technical one is that
Python's structure is dependent on consistent and proper indentation
(Four spaces per indent preferred.).  If that indentation gets altered
by using rich text, html formatting, etc., which this list does not
use, then people will not be able to copy and paste your code as is.
The Gmail email program will not do plain text automatically for you,
so if you do not know how to ensure this, then you have some Googling
to do!  If you want to see what your just sent email looks like to the
list members, point your browser to either

https://mail.python.org/pipermail/tutor/

or,

https://www.mail-archive.com/tutor@python.org/

and find your email and view it.  Looks like you are doing fine so
far.  Note:  The first link will have your email show up very quickly.
The second often seems to have a noticeable lag before it shows up.

Also, make sure when you have a problem with one of your programs that
you do the following:

1)  Usually state your operating system (OS) and version of Python
being used.  As you appear to be newly learning both programming and
Python I highly recommend you start with Python 3, which is now the
only version of Python being actively developed.  Python 2 is still
heavily in use, but now is in maintenance mode and will eventually no
longer get even new bug fixes.  The two books you mentioned both use
Python 3, so I suspect you have already realized this.

2)  COPY and PASTE the code you are having issues with.  Do NOT try to
hand-type your code in.  You will probably make a typo along the way,
producing code in your email that is NOT the code you actually ran and
inevitably introducing new errors in that hand-copied code which have
nothing to do with your original problem.  Another Gmail warning:  I
have found that when I copy something from the Python interpreter and
attempt to paste it into an email, my indentations vanish!  This means
I have to go carefully through my code and ensure that all of the
indents are recreated.  Eventually I will have to switch email
clients, but I have many things tied to making Google's environment
work (Android Nexus 5 phone, calendars, etc.) that I dread having to
figure out how to stitch together a variety of programs to recreate my
currently seamless digital experience.).

[An aside:  There are two ways to run Python code, in the Python
interactive interpreter and by invoking Python (Often from the command
line.) on a file containing valid Python code.  The first is handy to
experiment in as you get immediate feedback.  The latter is the form
your applications will be done in.  Python supplies IDLE, which
functions as both an interactive Python environment and as a Python
code editor/integrated development environment (IDE).  Any book or
beginner's tutorial you use should have a section on how to use the
two modes of IDLE.  And of course if you are already using a
programmer's text editor you like, you can use that instead.]

3)  COPY and PASTE the FULL TRACEBACK (That is, the error report
Python gives you.) that is generated from running the code you are
struggling with.  The Pythonistas can deduce amazing things just from
that traceback!  A tip:  Read the traceback from the bottom up.  Note
the line number(s) it points to.  Better tip:  Copy the error message
and paste it into a search engine--you will more often than not solve
your own problem by doing this bit of research.

Do not top post!  Instead interleave your comments.  If you do not
know what this means have a look at

https://en.wikipedia.org/wiki/Posting_style

For instance, if had top posted my responses to your email, you would
have seen all of this I am writing at the beginning of this email, but
your (trimmed) email that I would be responding to would be at the
bottom.  If I had top posted, the context that I am responding to
would be at the bottom in an awkward location to locate, especially
when someone runs on and on like I am now doing. ~(:>)

Three things that can help you solve many of your own problems:

1)  Study the code you are having problems with and try to rewrite it
in a much shorter and simpler form that accurately reproduces the
problem(s).  If you can distill your code down to a handful (Or less!)
lines that accurately reproduce the problem, then you will often see
the problem and solution yourself without having to ask anyone
questions!

2)  Search online for helpful information.  I have already alluded to
this above when I mentioned copying and pasting your traceback into a
search engine.  It is highly likely that others have had your very
same issues and found their answers.  Also, this shows people that you
are willing to work for your supper and are actually trying hard to
learn and do not wish to be spoon-fed.

3)  print() is your dearest of dearest friends!  When you do not know
what is going wrong, intersperse your code with print() calls in the
most likely trouble spots.  Print out those variables and see what is
really being referenced.

Now on to your *actual* questions:

>
> Out of a long list of books that I have collected ( python, Blender, etc )
> I have decided to start on Introducing Python (hard copy 2nd Ed, ebook 3rd
> ed) by Bill Lubanovic. Before that I was going to start with Python
> Programming for the Absolute Beginner, Michael Dawson.

I own "Introducing Python".  It came out a couple of years ago.  I am
pretty sure it is still only in its original edition.  OTH, the other
book by Dawson is in its third edition.  Are you sure you did not get
editions mixed up?  But that is not important.

You sound like me in that you like books.  I buy too many of them and
worse, do not read most of them.  So I think that you need to find a
book which goes at a pace you are comfortable with, talks geek-speak
at a level that is understandable, and that is interesting enough that
you are likely to study it from cover to cover.  Also, it needs to
have plenty of useful exercises/problems.  The real learning occurs
when you write and debug your own code.  A good book will have
suggested exercises that are challenging at the right level and
targeted to the concepts being taught at that moment.  Only you can
decide if a book is a good fit for you or not.

Are you totally new to programming in *any* language?  If yes, you
have much more to learn than *just* a programming language.  I am
going to assume that you are very new to programming in general.
Forgive me if I am mistaken!  But if you are, then some of the things
you must learn that are language-independent:

1)  You must have the ability to focus on the tiniest of details.
Programming languages care about every jot and tittle.  Whether a
letter is upper or lower case matters in most languages (Especially
Python.).  Spaces matter! (Especially in Python!!)  You will find that
most of your mistakes that cause you tremendous grief are because of
the tiniest, most insignificant typos, or similar errors.  I once
spent hours trying to make a segment of copied and pasted code work.
I just could not see anything wrong!  I eventually realized that the
quotes being used in the copied code were of two types:  those that
pointed slightly to the right and those that were pointed slightly to
the left.  But the font my system displayed these in made these
differences invisible to me.  It was only after I looked at the
characters' underlying display code that I discovered that they were
in fact two distinct characters!

2)  Programming is all about solving problems, no matter the language.
And you have to be able to express your solutions to those problems in
a sequence of very detailed, very concrete steps as if you were
talking to a very stupid person for whom *everything* has to be
spelled out in great detail.  I believe that your enjoyment and
success in programming will depend on your ultimate comfort level
here.  But if you relish the challenge of problem solving and feel a
huge rush of pleasure after having solved a particularly gnarly
problem, then Python and programming is definitely for you!  Plus the
creative aspect of fashioning something special out of nothing other
than the underlying ones and zeroes provides great satisfaction as
well.

3)  You will need a great deal of patience (and imagination!).
Getting everything just right so the very stupid computer will
ultimately bend to your unyielding will requires patience (and
imagination) in abundance.

4)  You have to learn algorithmic thinking, which is what much of
point (2) is about.  If this is foreign to you, then whatever book you
choose needs to teach you this.

And there are others.  You have to develop a programmer's way of
thinking and you need to learn and acquire these thinking skills.

So on these lines I do not think I can recommend "Introducing Python"
for you.  Despite claiming to be suitable for a newcomer to
programming, it is fairly fast paced and tries to go through a lot of
language details quickly.  And the level of geek-speak stays on the
fairly technical side.

Dawson's book is a fairly gentle introduction that I think you can
follow.  The problems with it will come when you try to get into the
game programming where he uses the livewires package.  Underlying this
package is PyGame.  People who have posted on this list have had
issues with installing, configuring, and using both of these.  If you
continue with the sequel to Dawson's book, which is written by a
different author, that sequel uses PyGame only.  The problem is that
these two books are using versions of livewires and pygame that won't
work as is with the most current version of Python 3, so you will have
some work to do to get your gaming packages these books use to work.

I myself recently read through the part one to "Python Crash Course"
by Eric Matthes that came out about a year ago.  He divides his book
up into two halves.  Part one is "The Basics" while part two is
composed of "Projects".  I think you might like this book, too.  It is
faster paced than Dawson's book, but not nearly so as Lubanovic's.  It
does not try to exhaustively cover Python's language features, but it
does cover the bread-and-butter ones rather well for a newbie's
perspective.  Matthes is a high school teacher, and I think he is
targeting that sort of level in his presentation based on his teaching
experience.  I think that you could use this book along with Dawson's,
delving into the latter when you need something broken down into a
more detailed explanation.  And then there are the projects you can
try out!  I did not go through those, though I probably should have.
But I have so many projects of my own going on that I have more than
enough to do.

There are a ton of good books and tutorials online.  Search for them.
Search the Tutor archives.  As you might imagine, your questions have
been asked often before.  Alan Gauld has an online tutorial that has a
link to it in any of his posts to Tutor.  He also has recently
released a book himself for learning Python centered around a projects
approach.

I have done way to much typing.  I hope that some of it might prove useful.

Good luck and have at it!

boB



-- 
boB


More information about the Tutor mailing list