[AstroPy] Python Books for Beginners?

Derek Homeier derek at astro.physik.uni-goettingen.de
Sat Feb 6 08:47:42 EST 2010


Hi Kelle, how's it going?

Glad to read your post - like some others here I am curious myself  
about what's
a good python introduction - and actually, what makes a good python  
book.

For a good compact primer, and also free, I still remember Dive into  
Python
http://diveintopython.org/
though not strictly for programming freshmen. More serious perhaps, it  
has not been
updated in a couple of years (references are still based on python  
2.2, so there must be a
bit of functionality missing, or methods being outdated by easier and  
more powerful
successors, like introducing getopt() rather than optparse). There is  
a version for python 3
now, but that isn't really much help with 2.6/2.7, I'm afraid.
The website also recommends the book below (albeit also an old  
version ;-),
which is probably a good sign.

On 5 Feb 2010, at 20:52, Rick White wrote:

> You might want to look at "How to Think Like a Computer Scientist",
> which is written specifically for teaching Python as a first
> programming language.  It was originally written for high school
> students.  I have not actually used it for teaching, but I think it
> might be usable for a college-level introductory course too.
>
> It is 270 pages, which is a much more reasonable size.  And it has the
> advantage of being available both in a published version and for free
> download (in PDF) or online reading (HTML):
>
> http://www.greenteapress.com/thinkpython/


Getting back to the question "what makes a good python book" actually,  
I'd like to share
some thoughts from my experience with students (though mostly graduate  
ones),
on what I would consider important topics for python beginners in  
science:

Learning about the data handling packages early on - numpy, of course,  
typically matplotlib,
important functionality from scipy and probably ipython as the  
interactive environment of choice.
Becoming familiar with more complex data structures like Record arrays  
also is extremely
valuable. Unfortunately much of this still seems unlikely to be  
covered extensively in textbooks,
given the state of the numpy/scipy documentation itself. Luckily this  
is quickly improving,
thanks to the efforts of everyone involved in that project!
You are probably familiar with Perry Greenfields data analysis tutorial:

http://www.scipy.org/wikis/topical_software/Tutorial

- perhaps still the best access to the core functionality of these  
modules, although quite
focussed.

Structured programming practices, in particular test-based development  
e.g. at

http://onlamp.com/pub/a/python/2004/12/02/tdd_pyunit.html
http://somethingaboutorange.com/mrl/projects/nose/

A similar good practice to develop early on, which will pay back with  
double interest later,
is documentation, but I think that is already emphasised in most good  
programming books.

I am not sure if object-oriented programming should be anywhere high  
on this list -
in my experience, most undergrads already had their good share of  
exposure to some
OO languages like Java or c++, so they are not unlikely to have better  
OO-programming
habits than their instructors ;-)

Comments and additions welcome - of course if anyone knows of a good  
book that
covers some or all of the above, I'd be very interested to know!

Cheers,
							Derek
--
-------------------------------------------------------------------------
Derek Homeier                         Institut für Astrophysik Göttingen
Georg-August-Universität              Phone:             +49 551 39-7980
Friedrich-Hund-Platz 1                Fax:               +49 551 39-5043
D-37077 Göttingen, Germany            Feet:                     E.04.104
Web:                   http://www.astro.physik.uni-goettingen.de/~derek/
-------------------------------------------------------------------------





More information about the AstroPy mailing list