Archive for category work

demangling ‘property’ values

I’m learning more about how properties work in Python. One thing I’m learning is that a property objects are only evaluated in the context of the parent object they’re attached to.
Read the rest of this entry »

No Comments

cool python tricks

Man I love Python. I came up with a neat trick yesterday that also couldn’t be done in any static language. Needless to say, I’m pretty pleased with myself. This trick isn’t slow or hard to understand, and actually makes a lot of my code very simple, and avoids a lot of boilerplate that I would have had to write in another language

I needed a way to given a basic color to a class, and then have easy access to various tints of that color for painting different aspects of an object. The tints are based on HSV, not RGB, but all the callers need to deal with RGB.

The solution: wrap the property() descriptor with my own descriptor.
Read the rest of this entry »

No Comments

How python can be fast

So now that I’ve been working with python for a good 3-4 months, I’m starting to understand why people like it so much.. a bit part of it is that its just so damn simple. Its so easy to write code that works very quickly. The syntax is very elegant and easy to read. I’ve come to actually prefer the indent-based code grouping over most other language’s braces.

But one thing that has been plaguing me is how a dynamiclanguage could actually be faster than a static language like C++ or Java. I have faith in the theory, but its just that: faith. Until today, I didn’t have any real world examples. I needed something that you simply can’t do in a static language without bending over backwards. Conversely, I needed something that required the dynamicism of a language.

I just picked up the Python Cookbook the other day and I’ve found a very concrete example about how a dynamic language can be fast.
Read the rest of this entry »

No Comments

Chandler

So where have I been? On January 10th of this year, I started working at the Open Source Applications Foundation. (http://www.osafoundation.org/) Its been quite an experience, and maybe I’ll actually start posting about THAT since I don’t seem to post about anything else here.

No Comments