Kerry interviewed Howard on the 7:30 Report tonight, and I have to vent my
frustration and horror somewhere. If anyone's reading this, please let me first
disclaim any credibility or expertise in economics and politics.
The issues today are the Reserve Bank's interest rate raise and Howard's
announcement that he will stay on to run for the next election. The Israeli
invasion was not mentioned (or else I missed it; I was cooking chilli).
Kerry's first line of attack on the interest rates was to highlight Howard's
earlier election promises of low (or lower than Labor, or non-rising, depending
on who's talking) interest rates. This is an obvious, pointless tact--anyone who
is still paying the slightest attention to any promise from this man has both
short- and long-term memory issues. Howard's deflection is that they are
"undeniably lower than under the previous Labor government," and the
"responsible decision" from the Reserve Bank. He speaks truth:
government has only the most indirect influence on interest rates, which are
primarily a reaction to inflation. In the 70's, Hawke governed over dangerous
inflation levels that were created during Howard's term as Treasurer. No matter
which direction you look at it from, Howard is talking shit and getting away with
it: either government creates high interest rates, in which case the Labor
interest rates were the result of Howard's financial mismanagement; or they are
primarily under the influence of external factors, in which case it makes no
sense to compare Howard's interest rates with Labor's.
Most disappointing is Beazley's media grab, where instead of pointing out the
banality of promising interest rates during an election; he tries to follow the
Howard line and ends up spinning the same propaganda.
Back to politics, and Howard's announcement he will run for another term. It
could never have gone any other way, of course, as apparantly all of Australia is
in love with our Prime Minister, if we are to believe the media; just look at the
posse of 14 year old girls he cuddles every day on his morning walk.
He's clearly got it in the bag, and even Kerry was egging him on with
encouragement and predictions of a record landslide outgoing win in the vein of
Reagan: "the sky's the limit." Asked if his wife played a part in his
decision, Howard assures us that his wife and children were consulted, and that
he always seeks their valued advice on political matters. Oh, really? I was
under the impression that the country was run by the elected Prime Minister and
his advisors, not his family. Can I see their credentials, please? What did
Jeanette think about the interest rate rises? As an Australian citizen, I also
value her opinion highly.
The straw-breaker for me, though, was when he said, "I have had good health
so far--*touch wood*--...". Did he just say "touch wood"? Good
golly, I can see it now: "The interest rates are low so far, touch
wood," "The free trade agreement with the United States hasn't had a
negative impact so far, touch wood," "Indonesia hasn't invaded
Australia yet, touch wood."
I'm going to go and live in West Wing world for a little while now; at least
their politicians go to Aimee Mann concerts.
pygame-ctypes: Rasterise functions
Most of pygame.draw is implemented now. The antialias functions silently call
the standard functions at the moment (this seems reasonable, since there are
serious artifacts in Pygame's aaline output that makes me doubt anyone is using
it). pygame.draw.arc is also unimplemented at the moment. The Pygame
implementation seems unnecessarily expensive, calling sin and cos for (more than)
every pixel. I haven't found a Bressenham translation, though.
Gnuplot may be cool..
..but it really sucks. So does its documentation. Took me a long time to work
out that a filled circle is pointtype "7", and to get points drawn in
black (instead of the default red), the *linetype* must be set to "-1".
Of course, these numbers change if I change the output driver from PDF to
something else (say, PNG). Seriously!
pygame.draw.rect is implemented using SDL_FillRect (four separate calls for
unfilled rect). Negative sized pygame rects are now permitted by using a proxy
object in place of SDL_Rect (which uses unsigned datatype) when required.
Automatic inlining in Python
Idea proposed by Richard; took a break from pygame-ctypes (and continued
extended break from the thesis of doom) to have a go at implementing it. Use
Python's AST interface to inline functions before they are byte-compiled.
Conceptually it's simple; transform something like::
def add(a, b):
return a + b
print add(5, 10)
def add(a, b):
return a + b
print 5 + 10
What I have so far doesn't take it quite that far, instead producing::
def add(a, b):
return a + b
__result_00001 = (5) + (10)
There's nothing especially limiting about the approach I've taken, just that it
would be a fair chunk of work to have it not break on generators, list
comprehensions, default return paths, keyword arguments, star and double-star
arguments, tuple arguments, and so forth.
Why stop at function inlining? Would static constant evaluation be useful?
Compile-time resolution of constants? Pull-up of loop invariants? Loop
There's a definite speed advantage to be had. The simple case above runs around
twice as fast even with my sub-optimal inlining. Note that I didn't have to
implement any crazy frameworks like PyPy or psycho--this will work on ordinary
Python code running in any Python implementation.
Any optimisations like these make certain assumptions about the
"dynamicness" of the program. Obviously the program will fail if the
function is redeclared (or deleted or replaced with some other object) after
being statically inlined. One assumption I've been thinking over as being
generally reasonable is that module-level variables set at the top-level (i.e.,
not within any suite) don't change once they are set, and that local variables
never override a global variable. This would allow an optimiser to rewrite
constants and functions to a useful degree (and I should think is a commendable
programming style, not a cramp).
Prototype code is here: inline.py
. It's undocumented and doesn't cover lots of
Rather than continue this hackery, a better approach might be to convert the
entire AST into something optimiser-friendly like SSA--then lots more of the
optimisations mentioned above should be simpler to implement. That would be a
lot of work though, and I'd rather see that much effort being put into a Python
JIT, where assumptions need not be made.