Monday, 18 February 2008

McGregors tearooms in Palmerston

While travelling around the south island recently, I accidentally stopped in the small town of Palmerston on the way back to Ashburton from Moeraki. Actually, I think we stopped there because someone wanted some of McGregors famous mutton pies. Personally, I like a good cup of tea, so stopping at a tearoom is always a pleasure and never a chore.

2008-01-14 - Travelling - McGregors bakery in Palmerston - 01 - Storefront

You go up to the counter, grab a tray, load on the baked goods or pies you want to buy and eat, and then proceed to the till to pay for what you have and order a pot of tea or two. After which you meander over to a table, picking one - it doesn't matter which, they haven't had time to clean any of them yet. It may have featured a lotto counter (which wasn't working of course), but it was an authentic tearoom experience.

2008-01-14 - Travelling - McGregors bakery in Palmerston - 02 - Tea

As soon as we sat down, having cleaned off our own table, the tea arrived. It was remarkable how fast it arrived. And it was good. It has a bubbly "the detergent wasn't washed out" sort of look, but it was one of the better cups of tea I have had in a while.

2008-01-14 - Travelling - McGregors bakery in Palmerston - 06 - Top cuppa

And they had sugar buns. If there is one thing I like to eat with a cup of tea, it isn't a biscuit (or cookie as they say in the states), but a good slightly stale sugar bun. This wasn't stale and it wasn't the greatest, but it completed the tea experience.

2008-01-14 - Travelling - McGregors bakery in Palmerston - 07 - Sugar bun

No raspberry jam or lemon curd.. clearly it was not made by a sugar bun appreciator.

2008-01-14 - Travelling - McGregors bakery in Palmerston - 08 - Sugar bun innards

They also sold bran muffins. I tried a little of this, but it wasn't very memorable.

2008-01-14 - Travelling - McGregors bakery in Palmerston - 03 - Bran muffin

And of course, their famous mutton pies. This looks like a mutton ball placed inside a pie pastry shape. It didn't taste amazing, but after having lived through several years in pie barren Iceland, any pie which isn't a bad pie (Couplands?) is a good pie.

2008-01-14 - Travelling - McGregors bakery in Palmerston - 04 - Mutton pie

2008-01-14 - Travelling - McGregors bakery in Palmerston - 05 - Mutton pie innards

If I am ever back in Palmerston, this is the first place I will visit. Actually, given that Palmerston is off the main road, it will probably be the only place I visit there. Or the only reason I would even go there..

Comb honey

There are two types of "home country" food cravings for me.

The first is the craving I have overseas for something which I cannot obtain in the country I am currently living in. I don't tend to ever end up eating these foods when I return to New Zealand.

The second is the craving I have for things when I have returned to New Zealand and I see these things on the shelf in a store. Things I don't remember that I like eating. These I tend to eat and enjoy, assuming I consider the price worthwhile. Of these foods, one is comb honey. But I usually see it in the tourist stores in the airport as I am departing from the country, at extortionate tourist prices (for instance 20$NZ for a small container full).

I was in Ashburton shopping one morning with my father and he suggested we check out the new farmer's market they have there. After a short walk in the sun down the exceptionally wide Ashburton streets we reached it. There were about twenty or so stalls with people selling fresh vegetables, meat products (salmon sausages anyone? I sampled them and they weren't one of lifes treasures), flowers and other assorted things. One of them was selling honey and had a stack of comb honey on the table for 4$NZ a piece. I immediately walked up and bought one.

2007-12-22 - Ashburton Farmer's Market Comb Honey - 377

2007-12-22 - Ashburton Farmer's Market Comb Honey - 379

2007-12-22 - Ashburton Farmer's Market Comb Honey - 381

Modifying Python frame locals

Occasionally I find myself wanting to modify the locals dictionary of a Python frame. Ideally it might have been possible by doing the following:

import sys
def f():
v = 1
sys._getframe().f_locals["v"] = 2
return v
But this does not work and v will be unchanged. As far as I can tell, within an acceptable range of effort, it is not possible to modify the local variables of a frame.

One situation where this is useful, is when you are doing code reloading. When you identify a new version of a class, you don't actually want to replace the old version. Instead you want to take the easier approach and update the old version to be the same as the new version.
def UpdateReferences(oldRef, newRef):
currentFrame = sys._getframe()
for referrer in gc.get_referrers(oldRef):
if type(referrer) is types.MethodType:
newRef2 = types.MethodType(newRef, referrer.im_self, referrer.im_class)
UpdateReferences(referrer, newRef2)
elif type(referrer) is types.FrameType:
if referrer is currentFrame:
continue
# Problem case. Local variable replacement..

oldGlobals = existingFile.globals
for k, v in newClass.__dict__.iteritems():
if isinstance(v, types.UnboundMethodType):
f = v.im_func
# Duplicate the function but bound to the original globals dictionary.
g = types.FunctionType(f.func_code, oldGlobals, f.func_name,
f.func_defaults or ())
g.__doc__ = f.__doc__
if f.__dict__ is not None:
g.__dict__ = f.__dict__.copy()
# If the function already existed, update all references to it.
if hasattr(oldClass, k):
UpdateReferences(f, g)
# Inject the updated function on the original class.
setattr(oldClass, k, g)
There are other situations when writing support tools for a custom framework, where in order to allow programmers using it to write straightforward code, the inability to modify the local variables is a roadblock to the simplest solution - or to being able to do it at all.

If anyone knows of an acceptable way to do this, I would be interested in hearing about it.