Code and comments

Practical and theoretical aspects of software development

Archive for September 2011

Book Review: Core Python Programming by Wesley Chun

leave a comment »

CPP

If you are want to learn Python, and you like to learn from books, there is a clear consensus: Dive into Python. It’s available free online, so I gave it a try.

I didn’t like it. I felt bad for not liking it, after all, everyone agrees it’s a great book. Mark Pilgrim takes an interesting approach, diving in with real-world examples of what can be done with Python, rather than the typical approach of introducing the language systematically. But it just didn’t work for me. I found myself unmotivated by the examples, and bothered by the fundamental questions that hadn’t been answered. I had to look elsewhere.

Finding a reliable suggestion for an introductory Python text that isn’t Dive into Python isn’t easy, but John Cook recommended Core Python Programming(CPP) by Wesley Chun. I’ve agreed with John enough times that when it was time to actually learn Python, I bought Chun’s book. Read the rest of this entry »

Advertisements

Written by Eric Wilson

September 26, 2011 at 5:38 am

Posted in reviews

Tagged with ,

Why programmers count from zero

with 3 comments

If you are a programmer, you know that zero-indexed arrays and lists are just the right thing. Perhaps you read Dijkstra’s paper, or maybe you’ve encountered enough practical benefits to be convinced. But to non-programmers and students, zero-indexed lists seem extremely odd, and needs explanation. After all, we all know how to count, and it seems like it works OK when we start at one. What’s your good reason for starting at zero?

We have made this too complicated. While it is appropriate to have a careful answer for academic settings, we should have a casual illustration that is useful for casual inquiries. Here are my two suggestions:

Read the rest of this entry »

Written by Eric Wilson

September 21, 2011 at 4:22 am

Posted in didactics

Tagged with ,

Typesetting vertical arithmetic in LaTeX using xlop

with 2 comments

If the question involves mathematical typesetting, then you can be sure that the answer is LaTeX. But if you are off the beaten path, LaTeX can be both the solution and a new problem.

I was interested in typesetting some elementary-school style vertical arithmetic problems. You know, like:

  28
+ 15
----

 
Except with better readability.

Read the rest of this entry »

Written by Eric Wilson

September 19, 2011 at 12:29 pm

Posted in how-to

Tagged with ,

The first thing you should know about matrices.

with one comment

When you look at NumPy, Python’s numerical library, the first object you will encounter is the ndarray, or n-dimensional array. Also known as a matrix, right? Wait, there is also a matrix class in the linalg submodule, that can’t be right. And worse, matrix is not nearly as general as ndarray, it only allows two dimensions. Is that really good enough for real-world data?

Based on experience in higher education, I’m confident that over 90% of those that have seen matrices missed the point. If you don’t know why a matrix must have exactly two dimensions, than you don’t know what a matrix really is. (So read on.)

Read the rest of this entry »

Written by Eric Wilson

September 15, 2011 at 9:52 pm

Posted in didactics

Tagged with , , ,

Why my code is rarely Groovy

with 6 comments

I’ve spent over half a year using Groovy as my primary language, and it was a very good experience.  The flexibility of Groovy is a joy to anyone coming from the rigid Kingdom of Nouns, and the Grails web framework is excellent, far preferable to the various combinations of Struts/Spring/Hibernate (and others) that I had used with Java. And for a Java developer, the benefits of using the familiar, rock-solid Java infrastructure — libraries, web application servers, and the JVM itself — are significant.

I often found myself wondering why Groovy doesn’t get more interest among Java developers. After all, everyone needs a scripting language for small tasks, why not use one that you practically know already? And just because your production code is Java doesn’t mean you can’t test with Groovy.

But then a funny thing happened.

Read the rest of this entry »

Written by Eric Wilson

September 13, 2011 at 12:26 pm

Posted in commentary

Tagged with , ,

Python 3 Library updates, via twitter

with 5 comments

I’ve launched a new twitter account, @Py3K_update, which will send out tweets to notify followers when Python packages support Python 3. If this sounds like information that you want, please follow and/or tweet about this account.

If you are curious about the details, read on.

Read the rest of this entry »

Written by Eric Wilson

September 6, 2011 at 11:00 am

Posted in projects

Tagged with , , , ,

Getting started with The Little Schemer

with 4 comments

Every programmer should read The Little Schemer (pdf) at some point. It doesn’t take long to read, and I hope to provide a review of it soon. For now, I hope to explain how to get started practically with Scheme, as used in this book, since these details are hard to find.

Read the rest of this entry »

Written by Eric Wilson

September 1, 2011 at 9:52 am

Posted in how-to

Tagged with , , ,