Great Python books for the beginner

L

Landon

Hi, I'm a freshman in college and I'm going to be taking an intro to
programming course next semester which mainly uses Python, so I
thought it might be a good time to pick up Python beyond the scope of
the class as well. The text book for this class is Python for the
Absolute Beginner or something similar to that name.

I was wondering if anyone had any opinions on what other titles I
could look into since this one seems from a glance at reviews to be
teaching mainly through game programming (a topic I'm not too
interested in) or if this one is a quality book by itself.
 
B

Ben Finney

Landon said:
I was wondering if anyone had any opinions on what other titles I
could look into since this one seems from a glance at reviews to be
teaching mainly through game programming (a topic I'm not too
interested in) or if this one is a quality book by itself.

The book "Learning Python" is currently proving very useful to an
associate of mine. I'm watching his knowledge of Python grow
substantially every week, from what was an essentially zero start.

Learning Python, 3rd Edition
Mark Lutz
O'Reilly
<URL:http://www.oreilly.com/catalog/9780596513986/>

Looking through the text, it is very well structured, thoroughly
teaching all the fundamentals of the language and types and idioms
while referring back to already-learned material. The author makes a
living training people in Python, and the third edition has benefited
from his many years of experience finding effective ways to teach the
language.
 
S

sween119

Hi, I'm a freshman in college and I'm going to be taking an intro to
programming course next semester which mainly uses Python, so I
thought it might be a good time to pick up Python beyond the scope of
the class as well. The text book for this class is Python for the
Absolute Beginner or something similar to that name.

I was wondering if anyone had any opinions on what other titles I
could look into since this one seems from a glance at reviews to be
teaching mainly through game programming (a topic I'm not too
interested in) or if this one is a quality book by itself.

Hi Landon,

I've found the O'reilly books to be useful I have the Python Pocket
reference, which is helpful for me to remember the parameters
surrounding commands and all that.

I've been known to peruse the "Learning Python" book by the same
publisher and I really like "Programming Python" (though it is
thoroughly hefty and runs about $60USD)

But <http://www.python.org> has excellent documentation and if I may
put a word in for <http://www.pygame.org> to check out if you would be
at all interested in starting game programming.

-Sween
 
M

Mike

The book "Learning Python" is currently proving very useful to an
associate of mine. I'm watching his knowledge of Python grow
substantially every week, from what was an essentially zero start.

Learning Python, 3rd Edition
Mark Lutz
O'Reilly
<URL:http://www.oreilly.com/catalog/9780596513986/>

Looking through the text, it is very well structured, thoroughly
teaching all the fundamentals of the language and types and idioms
while referring back to already-learned material. The author makes a
living training people in Python, and the third edition has benefited
from his many years of experience finding effective ways to teach the
language.

--
\ "If you ever teach a yodeling class, probably the hardest thing |
`\ is to keep the students from just trying to yodel right off. |
_o__) You see, we build to that." -- Jack Handey |
Ben Finney

I would recommend Lutz's other book, the wonderful Python tome
"Programming Python 3rd Ed." as well. It's good for getting into the
deepest part of Python's jungle.

Mike
 
G

GeneralCody

Hi, I'm a freshman in college and I'm going to be taking an intro to
programming course next semester which mainly uses Python, so I
thought it might be a good time to pick up Python beyond the scope of
the class as well. The text book for this class is Python for the
Absolute Beginner or something similar to that name.

I was wondering if anyone had any opinions on what other titles I
could look into since this one seems from a glance at reviews to be
teaching mainly through game programming (a topic I'm not too
interested in) or if this one is a quality book by itself.

I would definetly go for Learning Python first, maybe Apress "Python,
from novice to Professional" as well...
 
L

Landon

One thing I wonder about is the examples these books use to teach the
concepts. I found myself really attached to K&R because the end of
section projects were utilities that I would find be able to find
useful in day to day work such as a version of wc and a program that
would take collapse all consecutive whitespace in a document into one
space. I could just use the projects from K&R, but I imagine a Python
book would have a better selection that highlight Python's abilities.

On another note, I would prefer to have a paper book so I don't have
to keep switching back and forth between documents on my computer.
 
A

André

One thing I wonder about is the examples these books use to teach the
concepts. I found myself really attached to K&R because the end of
section projects were utilities that I would find be able to find
useful in day to day work such as a version of wc and a program that
would take collapse all consecutive whitespace in a document into one
space. I could just use the projects from K&R, but I imagine a Python
book would have a better selection that highlight Python's abilities.

On another note, I would prefer to have a paper book so I don't have
to keep switching back and forth between documents on my computer.

You don't need to switch back and forth ... if you use Crunchy!

http://code.google.com/p/crunchy

To see it in action, http://showmedo.com/videos/video?name=1430000&fromSeriesID=143

(the third video in that series shows how to quickly get started using
the official Python tutorial).

André
 
D

Dennis Lee Bieber

would take collapse all consecutive whitespace in a document into one
space. I could just use the projects from K&R, but I imagine a Python

import sys
for ln in sys.stdin:
sys.stdout.write(" ".join(ln.split())) #if split() keeps the \n
# sys.stdout.write(" ".join(ln.split()) + "\n") #if \n is trimmed

You need a book to show this as a significant example? (NOTE: I'm
typing these off the top of my head, and haven't actually run them,
hence the option above)

"wc" is probably similar -- especially if you don't mind loading the
entire thing at one go...

import sys
print len(sys.stdin.read().split())

Line-by-line would be

import sys
sm = 0
for ln in sys.stdin:
sm += len(ln.split())
print sm

(I'm presuming wc just gives a total of the number of words in the
file... If you want a list of occurrences of each word, then it gets a
bit trickier... do you include punctuation, and case differences?)

Those utilities listed in K&R required actual manipulation of the
data, manual comparisons of characters and logic to determine if one
were in or out of a word, etc. All this work is handled by the Python
library, making the utilities trivial to code -- and probably not worth
coding the above: the time to load the Python interpreter and byte-code
compile the program could be a significant part of the run-time.

Word frequency, first cut (keeping case and punctuation):

import sys
wf = {}
for ln in sys.stdin:
for wd in ln.split():
wf[wd] = wf.get(wd, 0) + 1
kys = wf.keys()
kys.sort()
for ky in kys:
print "%40s : %10s" % (ky, wf[ky])

--
Wulfraed Dennis Lee Bieber KD6MOG
(e-mail address removed) (e-mail address removed)
HTTP://wlfraed.home.netcom.com/
(Bestiaria Support Staff: (e-mail address removed))
HTTP://www.bestiaria.com/
 
B

bruno.desthuilliers

One thing I wonder about is the examples these books use to teach the
concepts. I found myself really attached to K&R because the end of
section projects were utilities that I would find be able to find
useful in day to day work such as a version of wc and a program that
would take collapse all consecutive whitespace in a document into one
space. I could just use the projects from K&R, but I imagine a Python
book would have a better selection that highlight Python's abilities.

It wouldn't make any sens to port the K&R stuff to Python - different
languages, different uses, different problems... I mean, C is a low-
level language, mostly useful for low-level system programming, while
Python is a very high level language mostly useful for application
programming and Q&D scripting. So the applicative examples from K&R
are such no-brainers in Python they wouldn't teach you much, and the
more low-level examples (memory handling etc) just don't make sens in
Python because that's definitively not something you'd write in
Python.

But anyway: if you're looking for more real-life-like examples, Mark
Lutz's "Programming Python" might be worth a look.
 
G

Graeme Glass

Hi, I'm a freshman in college and I'm going to be taking an intro to
programming course next semester which mainly uses Python, so I
thought it might be a good time to pick up Python beyond the scope of
the class as well. The text book for this class is Python for the
Absolute Beginner or something similar to that name.

I was wondering if anyone had any opinions on what other titles I
could look into since this one seems from a glance at reviews to be
teaching mainly through game programming (a topic I'm not too
interested in) or if this one is a quality book by itself.

I found CORE PYTHON PROGRAMMING by Wesley Chun to be a great book with
help on both novice and advanced topics.
http://starship.python.net/crew/wesc/cpp/

The tuts and library reference on www.python.org are also really well
written and layed out and you will find yourself frequenting them.
 
M

MooJoo

GeneralCody said:
I would definetly go for Learning Python first, maybe Apress "Python,
from novice to Professional" as well...

Second those suggestions. Both are excellent books for the novice with
details more experienced pythonistas can use. Although it is an
excellent book, stay away from the Python Cookbook for now. Appreciating
it requires a good working knowledge first.

If you do get Learning Python, make sure its the 3rd edition that just
became available. It covers the current 2.5 release.
 
J

Jorgen Grahn

It wouldn't make any sens to port the K&R stuff to Python - different
languages, different uses, different problems... I mean, C is a low-
level language, mostly useful for low-level system programming, while
Python is a very high level language mostly useful for application
programming and Q&D scripting.

I tend to ignore exercises, sadly, but back in the days before Perl,
and on Unix, it was useful to write small utilities like that in C.
Maybe the K&R exercises reflect that.

(And the 'K' in K&R became the 'k' in awk, so these people were
clearly very interested in this application area -- and interested
in easier ways to do it than by C programming.)

Unix bigot mode: it seems to me to be harder and more tedious to
learn programming in a GUI environment like Windows. On Unix small
home-grown filter-like programs are useful: you have a good shell to
run them in, and you have a wealth of other utilities to connect
them to via pipes.

/Jorgen
 
J

Jorgen Grahn

Hi, I'm a freshman in college and I'm going to be taking an intro to
programming course next semester which mainly uses Python, so I
thought it might be a good time to pick up Python beyond the scope of
the class as well. The text book for this class is Python for the
Absolute Beginner or something similar to that name.

I was wondering if anyone had any opinions on what other titles I
could look into since this one seems from a glance at reviews to be
teaching mainly through game programming (a topic I'm not too
interested in) or if this one is a quality book by itself.

I like Alex Martelli's book, published by O'Reilly a few years ago (I
forget its name). It is not too thick -- books which are too thick to
stay open are useless IMHO -- and it's not a beginner programmer's
book.

(You'll have a text book, so it will teach programming in general and
simple Python programming, right?)

/Jorgen
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,046
Latest member
Gavizuho

Latest Threads

Top