Category Archives: Python

Fractal Memory Usage and a Big Number

In a previous post I said I’d talk about 4**(4**(4**4)). First, about the number. I first saw it mentioned in a math lesson back in high-school, when the teacher wanted to demonstrate estimation abilities. He wrote it on the board, … Continue reading

Posted in Algorithms, computer science, Fractals, Math, Programming, Python | Tagged , , , | 1 Comment

My Bad Memory, High Load, and Python

About a month ago the new Ubuntu 8.04 was released and I wanted a clean install. I downloaded an image and burned it to a CD. Just before installing, I tried “check CD for defects” and found a few. Turns … Continue reading

Posted in Personal, Programming, Python, Testing | Tagged , , , , , , , | 1 Comment

PyKoan – The Logic Game

As you can probably tell, I’m back from my undeclared hiatus. I’ve got lots of stuff to talk about, and I’ll be starting with PyKoan, one small project I’ve been working on lately in my spare time. A few weeks … Continue reading

Posted in Game Development, Math, Programming, Projects, Python | Tagged , , , , , , , | Leave a comment

Singleton: my use-case for class decorators

It seems that class decorators will finally be making an appearance in Python 3 and Python 2.6. I’ve thought about using them from time to time, but the use-cases weren’t that common. However, I did find myself writing a lot … Continue reading

Posted in Programming, Python | Tagged , , , , | 2 Comments

Python + Curses + Numpy -> Ascii Art Rotating Cube

Well, the title says it all, or at least most of it. If you are still not convinced, a picture’s worth 500 dwords: / |\ / | \ / | \ // | \\ / | \ / \ \ … Continue reading

Posted in Graphics, Programming, Python | Tagged , , , | 5 Comments

Python Tidbits

Memory Leaks With the advent of the Python’s garbage collector, it would seem that Python programs should not leak memory. However, this is not always the case. With just a bit of circular references, you can find yourself leaking quite … Continue reading

Posted in Programming, Python, Utility Functions | Tagged , , , , | Leave a comment

Issues in writing a VM – Part 3 – State and Memory

When implementing the VM, I had to keep track of state. The state of the VM includes the registers, virtual variables and memory. Fortunately, keeping track of state information is pretty easy. Basically, it amounts to having a dict, where … Continue reading

Posted in Design, Programming, Python | Tagged , , , , | Leave a comment

Issues in Writing a VM – Part 2

Writing a VM capable of executing expression trees is different from writing a VM for executing assembly instructions. Here I’ll cover several issues stemming from this difference. The first group of issues involve generality. Supporting a specific instruction set is … Continue reading

Posted in Algorithms, Assembly, computer science, Programming, Projects, Python | Tagged , , , , , | 7 Comments

The Case Against Floating Point ==

While working on the clipping bug, I had to do some floating point comparisons. To handle this virtual mine-field, I used simple precision comparisons. Not surprisingly, I wanted to know what’s ‘the right way’ to do this in Python. When … Continue reading

Posted in Programming, Python | Tagged , , , , | 3 Comments

Various Small Python Helpers

I’ve been working lately with arkon on various projects related to diStorm. One of these projects involved writing a solid Python API around an existing C API. This C API uses a lot of flags as arguments and return values … Continue reading

Posted in Programming, Python, Utility Functions | Tagged , , | 5 Comments