Think Python
An anonymous reader writes "In a neverending effort to spread the word about free quality online programming books, here is a Python programming book. 'How to Think Like a Computer Scientist: Learning With Python', by Allen B. Downey, Chris Meyers, and Jeffrey Elkner is a copylefted work available in multiple formats at Green Tea Press: HTML , PDF, LaTeX. Compliments of the online books what's new page."
This books has been translated to other programming languages (like C++ and Java)... so if Python is not for (it should be) you can read those too.
At first it looked like you were talking about a new IDE for writing Python programs ;) Anyone remember Think Pascal?
Thanks to Copylefted Online Books, I now can read the books before I buy.
On my bookshelf, seven of the books were bought after I read their online version.
I live in a third world country where there is no Towers bookstore, nor Borders, nor Barnes - there is NO WAY for you to know how good a book is without first buying the book - the bookstore here do NOT allow you to read the book !
The idea of Copylefted books really help me, and many others who are in the situation of buying books not knowing if the books are good or not.
Thanks again !
Muchas Gracias, Señor Edward Snowden !
Am I the only person who thought the title of the book was "How to Think Like a Computer Scientist: Learning With Monty Python"?
Man, it's early.
I think part of the problem is the name `Computer Science', which gives a wrong impression of what the core of the poodle really is. That's like calling Astronomy `Telescope Science'. I have met so many people who didn't want to study CS at all - they just wanted to learn `installing Linux and setting up a web server'. This has regrettably put universities under pressure to change their curriculum...
Some universities (eg. Edinburgh) have started calling it `Informatics', which is much more appropriate. (In fact in Germany, and probably elsewhere, it was always called `Informatik'.)
Maybe there should be CS *and* Informatics.
Uhm, guess that was offtopic.
Another excellent free book for Python is Dive Into Python by Mark Pilgrim. It is available in HTML, PDF, Word 97, Windows Help, plain text, and XML formats.
This book has plenty of examples and pointers to further reading on each subject. It features good layout, use of colors, and typography which makes for easy reading and comprehension.
I only find two versions - Java and Python.
Where can I find the C++ version ?
Thanks in advance !
Muchas Gracias, Señor Edward Snowden !
True 'Computer Science' covers a lot of areas, mostly fundemental, including Computer Theory, Electronics, Mathematics, Logic, Processor Theory and Design, to name but a few.
The majority of today's CS Courses seem to fall into two broad categories, 'Software Development', and 'Systems Management'. Whilst these are both elements of computer science, they do not encompass computer science as a whole.
Universities are more and more often cutting out the core Computer Science components of their courses, such as Electronics and Computer Thery, which is a shame - whilst the courses leave graduates with an understanding of 'How' to do certain tasks, they are left with no understanding of 'why' they are done that way, because they have no real understanding of how the Computer Systems they are carrying out tasks on actually perform their functions.
NDFSM's are important, Karnaugh Maps are important, Understanding the CPU F/E Cycle is important too - bring back real CS to our Universities!
Disclaimer: I meant what I thought, not what I wrote! What? You can't read my Mind? Oh dear!
Feynman once said during an interview that some 'sciences' were really pseudosciences, in that they have never made any laws, eg social science, is computer science a real science with laws, or a pseudoscience?, if its a science, does anyone know of any of these laws?
I'm a rabbit startled by the headlights of life
Practical PostgreSQL
Using Samba
Personally I thought both were very well written, the samba book has helped me greatly.
Kyle
http://www.unlogikal.net/
This book doesn't strike me as a book on how to think like a Computer Scientist, except insofar as Computer Scientists generally make lousy Software Engineers. There are no descriptions of the advantages of object oriented programming, discussions of theoretical topics, and in general very little encouragement to view programming as a science. Basically, this appears to be just a book on the Python language, written for someone who has never programmed before. That's a fine thing, don't get me wrong. My brief look even makes me think it could be an effective example of such a book. At the very least, I think it's hyped wrong.
However, from a software engineering point of view, I find it damning that the book forgoes any explanation of the practice of, or motivation for, writing maintainable code. I consider that unforgivable in a beginning programming book. You absolutely have to impress on newbies early the importance of documentation, sensible structure, logical variable naming, good class hierarchy, etc.
I consider this especially true for Python, which is an interpreted non-declarative language (making maintainabilty all that more important). Python is, conversely, also especially well designed as a platform where such concepts could be taught. It largely overcomes the occasional weaknesses of its design philosophy by consciously including language features such as built in support for docstrings, well crafted namespaces, modules as first-class citizens, etc.
Yet, these language features are barely given a nod in this book.
It's books for existing programmers that can afford to skimp on these areas.
From the opening section of each book: 1.1 What is a programming language?
Java is an example of a high-level language; other high-level languages you might have heard of are Pascal, C, C++ and FORTRAN.
Python is an example of a high-level language; other high-level languages you might have heard of are C, C++, Perl, and Java
Both C++ and Pascal are high-level languages; other high-level languages you might have heard of are Java, C and FORTRAN
C, a language without file i/o, without bound checking, and with direct access to ports is high-level? If you say the libraries chucked into a C load makes it so... Then Assemebler is a high-level language, too.
Last I heard was Binary Code=0, Assem=1, C=1.5, Fortran, Cobol, & Basic were about 3, ADA, C++=5.
Perl was not even in the picture, because it was scripting language
Also high-level languages does not equal easier code or does not make it faster code... It does makes more strict to code, more following the limited ways the authors of the langauge thought you should think (like the use of GOTOs :-). Low-level languages allow the coder the freedom to get the job done and not comprise the functions to limits of the authors, and it requies the coders to truely think like computer sceincist. Look at ADA for what is wrong with really high-level langauge. See how limiting the langauge can be made. And how much time is need to see up the coding effort.
PS: maybe these are great books, but I stopped reading there, because how can it teach to "Think like Computer Sceincist" when it does not know about the basics of computer sceince?
Does anyone know if the author of the book gets paid by Green Tea for donating or "copylefting" the book?
I'm working on the theory of collecting tax deductions for copylefted art, and this contribution is a great example because it closely resembles historically donated items. If the author donates the artwork to the right organization - he could by my reading of the IRS be paid in tax deductions.
Does anyone know of cases in Open Source / Copyleft where tax deduction are being used to help cover expenses?
I'm sure that the competition - i.e. Microsoft uses every tax deduction in the book. Are Open Source contributers playing by the same rules - or are we handicapping ourselves by ignoring the tax benefits of donation?
If anyone can provide examples of copylefted donations and how you documented it for tax purposes - I'm interested.
I believe there are Billions of dollars in potential government funding just waiting to be collected by Open Source artists. Lets go get it!
AIK
While Python is my favourite language, I think it's rather silly to teach Computer Science and especially basic algorithmics with a language that doesn't have pointers.
At low level, pointers are everything, and low level is what you want to teach when you're teaching basic data structures and algorithms. There's simply no point in demonstrating list implementation with an interpreted language that has very efficient native lists, dictionaries, etc. C/C++ or Pascal are much better for that; with them you can teach real implementations, not toy ones.
On the other hand, Python might be ideal for teaching advanced algorithms such as sorting and string algorithms, as those are more "high-level" problems and low-level pointer-messing is no longer needed nor desired. Python has very beautiful string and list operations, which make such algorithm implementations cleaner.
Also, Python might be ok for the very first Basics of Programming course with respect to pointers, as they don't really teach any algorithmics there. However, the weak typing (very late binding) would be a problem in this case. Beginners will have enough trouble understanding the language without the need to handle implicit types. I'd very much suggest a strongly typed object-oriented language such as C++, Java, or Eiffel, where the types are always explicit. For an algorithms course this isn't so much a problem.
For some classes, such as AI, there's simply no winner for Prolog, and perhaps Lisp, but many Python features such as easy string manipulation and other middle-level data structures make it temptating for many subjects such as Automata and Formal Languages. It would be interesting to have a good Python interface to a Prolog interpreter; one that is well integrated with the syntactic philosophy of Python.
After having a quick look at bits I'm qualified to assess (I'm not a Python programmer, but do have plenty of background in CS, C++ and other related topics) I'm not convinced at all that I'd want to learn from this book.
Much of the preface by Jeff Elkner basically compared C++ to Python and has a go at the deficiencies of C++. It would be more convincing if he knew the return type of main(), the name of the standard header <iostream> and what a statement was. Three fundamental mistakes just in discussing "Hello, world!" is not a good sign for the author's level of knowledge and understanding.
Trying to put aside my bias, as I like C++ as a practical language, I examined the appendix on creating a UDT for fractions to form a second opinion. Here, they do the obvious simple things to create a rational number class, and nowhere do they make the basic sanity check that your denominator is not zero. Surely one of the basic tenets of OO theory is that you always maintain your class' invariant properly? Their class may be a fine demonstration of Python's OO features -- I don't know, I'm not familiar enough with them to judge -- but it's a lousy demonstration of either good CS or good OO.
From these observations, I have to ask whether I'd actually want to learn Python from this book. If I do, how will I ever have any faith that what I've learned is correct and in good style?
If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
I've written a review of this book on The Assayer. The book is self-published (the authors run Green Tea Press), and one of the things people don't realize about self-publishing is how hard it is to attract reviews. (Actually, it's hard in ordinary publishing, and even harder in self-publishing.) Without reviews, you don't get much credibility. So if there's a free book in The Assayer's database that you've read, please write a review!
Find free books.
Quite to the contrary, I believe it is you who does not understand my observations.
Given a countably infinite amount of time, one can set a Turing machine running on an input, and then simply observe whether it halts or not. Heck, you can set it running on a countably infinite number of words, and see if it halts on each one. In other words, you can solve the halting problem.
Likewise, you can get super-Turing power if you can compute with real numbers (not floating-point approximations, but the true continuum). But again, due to the physics of this world, we can't maintain analog values with an infinite degree of precision (due to thermal noise, etc.) This has even been published in the journal Science by Siegelman, et. al. a few years ago.
In any case, you've made it clear in your post that you are unable to think these things through for yourself. You simply read Feynman, and accept it as gospel truth, because it came from the mouth of a great prophet.
Not really. Syntactically they are different, and Python certainly has some conveniences(named parameters come to mind as a big one), but the underlying ideas are not incompatible.
Both actually have remarkably similar approaches and capabilities with regard to object-oriented programming(this in terms of Perl 5).
Python's functional programming ideas can fairly easily be translated to Perl constructs such as map and grep.
Not sure how easily generators would translate to Perl, as I've not had occasion to use them yet.
"How to think like a computer scientist" is a bit much for this book. It's an introduction to Python programming, and at best, a mediocre one. It's aimed at the overpopulated "first book on programming" market. The book reads like a BASIC programming manual of 25 years ago.
Actually, Python and Perl are very different:
- Python is strongly dynamically typed, while Perl is weakly typed
- Python has a small number of syntactic constructs, while Perl has many
- In Python, everything is an object
blah, blah, blah
C is a system level language, and is still used widely, especially in OS and VM coding. The whole point is for C to remain stable. I certainly don't see Python being used in these applications, and it doesn't deserve to be used at the system level either.. Python is nothing but a glorified scripting language.
mogorific carpentry experiments
-Kevin
You have failed to understand the point of Computer Science (pun intended). Python is a terrific language for teaching CS because it has the basics of discrete structures: lists, maps (in Python, called dictionaries), tuples, and atomic data types such as strings, ints, and reals. That's all you need.
There's really nothing you can't do once you have lists and maps. Don't object that you can't have O(1) access-time arrays -- you can do that with a map.
I challenge you to describe any algorithm at all that can't be implemented without pointers. If you think you need pointers, you just aren't thinking like a computer scientist.
For some classes, such as AI, there's simply no winner for Prolog, and perhaps Lisp
In general, you are absolutely correct. Of course, this is opinionated and others may disagree. But remember, you can use any Turing-complete language to simulate any other Turing-complete language (that's the entire definition of Turing-complete). Which means I can write a C interpretter in Prolog if I want (and I'm feeling particularly masochistic), and therefore I can simulate pointers using Prolog.
Oh, but you cry "That can't possibly be efficient!" Right again. But you've again missed the point of Computer Science. CS is about efficient algorithms, not efficient programs. That's something we leave to the software engineers and other "implementors." Us CS freaks think about what can be done, we don't actually do it ;-)
from the because-thinking-perl-hurts-too-much dept.
Thinking (and writing) Perl doesn't hurt at all. It's reading Perl that hurts. Write Once Read Never.
You had better go talk to a tax attorney before you land yourself in jail for evasion.
That said, I don't know if I would teach a begining computer science course in python. At my University, our general intro to CSE involves a two class series teaching generic basic theory wrapped around a programming language. We used to teach them with C and C++ but just recently moved to Java. I have been a TA for these classes before. Based on my experiences, I think there are both pluses and minuses to the idea of teaching these classes in python.
Benefits:
- Python is extremely easy to learn, as mentioned before. Much easier than C, C++, or Java.
- Python works really well with Tk, which would make it easy to build out skeleton code (multiplatform skel code at that) for the students using windowing and graphics. Students are 100% happier if they can see what they're working on reflected graphically. Makes it more fun to show off. This is why our projects usually include basic games.
- BASIC Python is truly, completely, multiplatform, working identically on Mac, Win*, and *nix. Some specialized functions in modules don't support all platforms, but nothing that would be important to a begining student. Support issues would be MUCH simpler than C or C++. God, we had huge headaches trying to support MSVC, CodeWarrior, CodeWright, Borland, etc. . .
- There is a great installer script available that will build python modules into either standalone exe's or distributable directories. (Available here if you've never seen this before)
But, there are also some downsides that would have to be weighed. These are:Looking away from basic intro classes, python is great to know. I did a lot of AI code sketches in python, and have used it to slap together simple programs at work. However, I would consider it a tool to be learned after the basics have been beat in. If I had learned python first, it would be a lot harder to force me to do everything in C later.
-s
- - - - - - - -
Don't worry, being eaten by a crocodile is just like going to sleep in a giant blender.
- Python is strongly dynamically typed
...causing much wear and tear on the keyboard
If you actually look at the book in question, you'll see that the original poster was correct: it's not about computer science at all. It's a Python programming book with a marketing angle relating it to computer science.
If you really want a book which teaches "How to Think Like a Computer Scientist", try SICP. For a good summary of the book, see this comment from the recent "Best Computer Books" article.
While not CopyLefted, Bruce Eckel has online a 0.x version of Thinking in Python, which is more pattern oriented.
Good response. I just replied to one of your other posts about your tax deduction idea, but when I saw this I wanted to add: getting Federal matching funds for Open Source is not a bad idea, but I think you may be looking in the wrong direction when it comes to the IRS. However, the Federal government gives out grants for all sorts of things, and it would seem to make more sense to look in that direction for ways in which open source might fit into existing programs.
But I doubt you'll find some existing loophole that allows you to simply receive cash for open source by just filling out a form. More likely, with a lot of political lobbying etc., it might be possible to get the government to be more receptive to funding open source projects that are in the public interest. However, you'll have to fight lobbies of commercial software makers who feel threatened, so it's not likely to be easy.
If you want to be realistic instead of ideological (no value judgement there, just being pragmatic), you might have more luck finding a business which is interested in contributing towards the work in question.
At low level, pointers are everything, and low level is what you want to teach when you're teaching basic data structures and algorithms.
Conceptually and from a computer science perspective, the object references present in languages like Python, Java etc. are equivalent to pointers in all the ways that matter for representation of data structures and algorithms. In the academic community and elsewhere, it's generally considered beneficial to teach such things without reference to the machine pointers which you're referring to, since machine pointers carry a lot of baggage that's unrelated to the abstractions involved in data structures and algorithms.
There's simply no point in demonstrating list implementation with an interpreted language that has very efficient native lists, dictionaries, etc.
To refute this, let me offer a tutorial: A Gentle Introduction to ML. If you work through this tutorial, you'll very soon begin implementing functions in the ML language for basic list operations and the like - functions that already exist in the language. And guess what: the implementations that the beginner typically comes up with in that tutorial are very close to the actual implementations that ML uses - the tutorial gives some examples of actual implementations for comparison.
This high-level operation doesn't even cost much -languages in the ML family, including OCaml, regularly are top performers - see e.g. Doug Bagley's language shootout. They can perform on par with languages like C because their type systems allow sophisticated compile-time optimizations to be performed, and their high-level abstraction features are supported by optimizations such as tail recursion.
C/C++ or Pascal are much better for that; with them you can teach real implementations, not toy ones.
If you believe that C/C++ and Pascal are good languages for teaching computer science, you don't know much about modern computer science. All three of those languages have very weak type systems and lack basic features that allow the construction of high-level abstractions.
Pascal is all but a dead language in the CS community nowadays. The primary use for C is as a decent portable assembler. Learning C has very little to do with computer science, and absolutely nothing to do with teaching computer science concepts.
my local community college puts stuff like Introduction to Microsoft Word under Computer Science! gaaaaaaaaaaaa!!!
I think part of the problem is the name `Computer Science', which gives a wrong impression of what the core of the poodle really is.
Well, yeah.
I'd make the following analogies:
CS is a science that deals with unravelling how information and logical systems function and developing frameworks to understand them. CS are most likely to determine the boundaries at which things can happen and to lay out how to practically approach that boundary.
Software Engineering is an engineering discipline that deals with manipulating those systems to perform a needed task. They take the work of the CS and design systems to address specific problems. Quick and dirty is just fine, provided that all the needs are being met.
Coders assemble the systems that the SEs design and informaticians maintain those systems.
There's overlap among all of them to some degree, and plenty of people do them all, but from an education point of view, if you mix them together, you get a mess - and most schools mix them together. It was easier to mix them in the past because the field was narrow. But now, you just can't do it.
CS has become very deep, and you can't get into any of the real work if you spend your time dealing with SE and coding practices. SE has become very deep as well and you don't want these folks getting bogged down with the NP completeness proofs and whatnot, or with learning the programming tools too much. There's enough to do in all three areas that they need to be treated as different but complementary disciplines...
Yes, but not everything behaves as one would expect an object too, leading objects of certain classes to behave as primitives. Unless there's been quite a bit of type/class unification progress made, I don't believe you can subclass some of the more basic(and useful!) objects either.
In this respect Ruby has both languages(at least until Perl6) beat.
I'm not saying they're exactly the same, but I do think they're more similar than most people like to think.
of all sciences. Believe it or not, CS means nothing unless you know some other science (but it can also glue other things, like information management, which is not a science but actual data).
unfinished: (adj.)
Ooo! I _knew_ I was gonna get flamed for
choosing a pretentious title. Really, it's
mostly meant to be silly (not a marketing
angle).
The book is (just) an introduction to computer
science that focuses on the basics of programming.
It covers the material I've been able to get
college students to understand in one semester,
which means yes to functional and data abstraction
and no to modules as first class citizens.
It's also aimed at people with no programming
experience at all, so I tried to explain the
basics slowly and LOUDLY.
Thanks to all the slashdotters that have commented
on the book!
Cheers,
Allen Downey
Many thanks !
Muchas Gracias, Señor Edward Snowden !
Nice!
I've apparently been out of the loop a little too long.
Perl 6 is hardy convulsing. It's actually coming along quite nicely.
It also has the advantage of being a fresh start(it behaves much like Perl 5 in everyday use, but for different, better, more consistent reasons). Python is a wonderful language, but that doesn't have to mean Perl can't be a great language too.
I'm gonna make a bold claim with the electronics bit, but it's kinda.... easy. I do think it should be taught, though. I'd never really played with electronics much until a recent embeded project at work and the EE's from the lab came in and started drilling me on , like , what sorta DAC's we'd be using and the like. Out came the books. The thing that struck me was how easy it was to schematify a little circuit up (ignoring ugly stuff like, oh say resistors and the like!) that I could give to the EE's to make into real toys. But that's because back in the day we actually learned how this stuff fits together. Really, if one can understand the finer points of stack tuning then figuring out that one needs to provide a latch to a parallel thinger is not too hard. real CS rocks, and amazingly once or twice in a career it actually gets used.
Excuse the Unicode crap in my posts. That's an apostrophe, and slashdot is busted.
I think one of the amazing things about being an Adult is that at school, I remember hating math and the like. Nowdays I really find it interesting. Peg me a geek perhaps, but I actually find it interesting. In school , pot & females sorta distracted from it all, but yeah, being able to confound the boss with some whacked out equasion does have it's bonuses, and sure, knowing *how* to figure out whether to unroll that loop is a handy thing.
Excuse the Unicode crap in my posts. That's an apostrophe, and slashdot is busted.