August 2009

Python: Find objects of a certain type in memory

This code snippet will allow you to look for objects of a certain type in memory. This is very useful for plugins:

"""
    This looks through all the objects in memory, to find ones
    of the designated type.
"""
 
import gc
 
class Animal(object):
    def make_noise(self):
        print "snort"
 
animal = Animal()
 
for obj in gc.get_objects():
    if type(obj) == Animal:
        obj.make_noise()

Code Fragment
linux

Comments (0)

Permalink

Rester Screencast 1: Intro and Server Push

During my job hunting, I was going over my resume and portfolio. I noticed that my project Rester is just about a year old. It is also getting to a point, where is is almost useful to other people.

If you are interested: Rester is a fast RESTful web server and framework written in D. It should be as easy to use as Ruby on Rails, but provide good performance by default, and be easy to deploy.

I made a brief screencast, with an introduction and an example that uses server push.


rester_1.ogv (27.7 Megabytes):

You can also view the video in the legacy flash format at Youtube:
http://www.youtube.com/watch?v=uBfdn5RCrlw

Feel free to try it out yourself, and leave comments.

development
linux

Comments (1)

Permalink