Welcome to a new year at Python for Humanists! I'd like to use this post to point out a few things that commenters have shown me since I last posted. John Case wrote a very good rejoinder to a few of the ideas I presented in my last post, saying "[a]s a developer, I'd like to say, generally, if extra lines of code makes it easier to understand how the code works, use the extra lines of code! It's incredibly frustrating to try to reverse-engineer someone else's code because they were trying to be too clever and would end up with some abomination that's impossible to debug or modify." John makes a great point. The whole point of Python is to create code that others can easily use. And sometimes being too simple can end up making your code more difficult to read. So, while simple is generally better than complex, don't create code that others cannot read or understand.
Second, David Haeselin recommended MIT's OpenCourseWare's Intro to Computer Science class, which he says "teaches Python." Here's the first lecture on beginning to understand computational concepts lead by Eric Grimson and John Guttag. The beginning of the video discusses the logistics of the class, and the discussion of computation begins around 16:19.
Some interesting ideas I got out of the first lecture:
- What does it mean to think like a computer scientist? Grimson begins his lecture by contrasting declarative statements (meaning those statements that create statements of facts, an example is an algebraic equation) with interrogative statements (meaning those statements that teach us how to do something). Statements of fact simply teach us facts. The equal sign in a valid equation expresses that the statement is true. Interrogative statements teach the computer to do something based upon a mathematical variable. Thinking like a computer scientist means thinking computationally: that is, thinking not about fact but about doing things.
- What is the basis of computation? Possibly the most interesting part of the lecture comes when Grimson discusses the difference between fixed computation (computers that are designed to do only one type of computation like a calculator) and stored program computers that can change how they compute based upon a program or recipe. The latter changes its computation based upon an input, and is what's known as an interpreter. The interpreter forms the basis of the computer. The idea of the computer is building descriptions off of a sequence of primitive instructions, and that sequence is combined with a flow of control.
- What are the basics of Python? Grimson discusses the kind of language Python is, why it does certain things better than others, and how it helps you check syntax and fixed semantics. But he also lists some basic values and primitive data elements that drive python including numbers and strings.
The lecture is a good introduction to understanding what computation means and how to conceptualize what is going on when you create a Python program. I would recommend the entire series of lectures for anyone learning how to program.
In the Blog
- The Extraordinary World of MARBL: Charles H. Herty Turpentine Cup
- Postcolonial Studies @ Emory
- A Beautifully Illustrated Book in the Seydel Collection
- The Extraordinary World of MARBL: Medical Formulas from the Reed Family
- New tech e-books:Safari Books Online
- The Extraordinary World of MARBL: Resurrection City Street Signs
- The Extraordinary World of MARBL: Ralph McGill's Paper Bag Letter
- Sisyphus: Patron Saint of the Stacks
- Cake Sprinkles, Cigarettes, Pasta, and Rusty Razor Blades: Preservation Challenges in MARBL
- The Extraordinary World of MARBL: Robert E. Lee's Socks