PhysioPhysiotherapy is great, but expensive when you have it
several times a week. I think my
shoulders are slowly improving without needing physio
anymore, so I probably won't be making any further
appointments. It'd be good to be able to stop consciously
thinking about my shoulders and wrists, though.
Twisted
19:21 <adiabatic> get a flower and say to
yourself "how can one screw up sending a filelisting via
passive FTP? let me count the ways..." and then start
plucking petals
0.18.0 was released a while back, and seems to be solid.
Unfortunately some of the FTP unit tests are failing again,
and there seems to be really nasty timing issues involved --
adding a blank print statement to a single-threaded
program should not make a test pass. Similarly adding a
time.sleep(0.1) call somewhere else shouldn't make
another test fail.
The FTP server code is sufficiently ugly that I think
I'll simply rewrite most of it, and see if the bug goes
away. It needs a rewrite for other reasons anyway, it
should be using stuff like twisted.cred. I
suspect this is simply a different manifestation of the same
bug that causes the bulk of the FTP tests to fail on Win32.
At least I'm reasonably certain the bug is in the server
and not the client code, which means it's not my fault ;)
PyGTK
I had an opportunity to muck around a little with PyGTK
this afternoon, helping a housemate plot a wave to a pixmap
in a window. It turned out to be surprisingly difficult,
mainly due to us making various incorrect assumptions. I
stupidly assumed that the colormap's alloc method took 8-bit
RGB values (I'm too used to HTML), whereas it took 16-bit,
meaning that I everything I did seemed to come out black.
The other big problem was that the pixmap persisted between
invocations of the python script! That meant that making a
change and trying that, then undoing the change and trying
again would not give the same results as the previous time
until we explicitly cleared the pixmap with a draw_rectangle
call. GUI programming is painful.
Python
A small problem that I occasionally bump into: sometimes
you want to iterate over every 2nd item of a sequence (or
more generally, every n'th item). I'm yet to find a
satisfying solution to it, as it doesn't map cleanly onto a
for loop, and slices don't support skipping n elements like
that. You could do it with a generator that keeps a
counter internally, or perhaps subseq = [seq[x] for
x in range(0, len(seq), 2)]. Actually, that list
comprehension isn't so bad, that didn't occur to me before.
I guess I'm just feeling spoilt by Python's tuple unpacking
that allows stuff like
for a,(b,c) in [(1,(2,3)), (4,(5,6))]: ...