Sunday, March 30, 2008

More Python and Climate

Apparently my rants got linked by GravityLoss, who understands that I am saying something about Python and about modern methodologies, but apparently isn't sure exactly what.

Here's my reply:

Hi and thanks for the links.

Make no mistake, I am a Python fanboy. I really doubt it's possible to do much better than Python at our present level of understanding of how to control computers.

As Paul Graham explains, any assertion that a more advanced technology Y is better than technology X tends to fall on deaf ears on users of technology X, because what they think is doable is defined by technology X. It is perfectly possible to get no advantage from Y because it is always possible to do X-like things with it.

I am proposing to do somewhat different things with Y. I am not the greatest expert on Y, but I do see things to do relevant things with Y that are not entirely X-like.

I would like to have software managers more experienced than myself involved. Google are the folk with the disposable wealth and the farsighted motivation as well as some of the relevant skills. I sort of wish they'd do what I want to do rather than leaving me scrambling to do it. I retain enough hubris to suggest that if they tried they'd do well to get me on the team. Realistically I probably will not have their help nor the help of an experienced software manager, though any pitching in from JM or JM would be most welcome.

There's nothing magic about Google or Python that aren't summed up in Clarke's Law: any sufficiently advanced technology is indistinguishable from magic. The sad thing is that much of the academy, including climate science, is far enough behind the cutting edge of what is possible that comparable productivity would look magical.

Friday, March 21, 2008

The elegance of Fortran

You know, the point of OOP is to SAVE work. 

Yes, the following is the most trivial and trite and pointless possible example of OOP.  I am not showing you code that is interesting. I am just comparing it with bolted-on OOP. Have a look at the Fortran equivalent. It's completely equivalent, note.

The "polymorphism" section form the Fortran is expressed in Python as an arbitrarily small amount of whitespace. And you thought whitespace was a drawback of Python!

def vectorsum(vec1,vec2):
...return map(sum,zip(vec1,vec2))

class Circle(object):
...def __init__(self,center,radius): = center
......self.radius = radius

...def __str__(self):
......return "circle of radius %s at %s" % (self.radius,

...def move(self,translation):
......assert len(translation) == len( = vectorsum(, translation)

class Square(Circle):
...""" note: can inherit constructor for circle; treat radius as length"""
...def __str__(self):
......s = self.radius
......shifts = ((0,0),(0,s),(s,0),(s,s))
......corners = tuple([vectorsum(,shift) for shift in shifts])
......return "square at points %s %s %s %s" % corners

Saturday, March 15, 2008

PyCon snippets

Stuff to look into:

iPy1: a spawned interpreter on every CPU

MPI4py: the winner for fine-grained parallelism

distributed NumPy array: Brian Granger

"it's like a beginner trying to make a souffle; you WILL get an egg dish"


new buffer type in Py 3, Travis O in charge, imports NumPy arrays; PEP 3118

struct module

Amazon's elastic cloud; Pete Skomorock's ElastiWulf

Trestle ; saturdayhouse.prg




math instruction in APL

if you want to start a conversation, ask a question