Friday, May 21, 2004

I'm surprised I got a link from the Daily Python-URL concerning my observations of what I could do with my Python IDE project when the Frontier source code gets released. I thought it was rather obvious myself. I was mentioning that to a friend of mine, and his comment was "That means they want you to do it."

I should know better than to make observations like that in a public forum. People then expect me to follow through... (smirk)

Since this seems to be the week were I'm posting observations that are old hat for me (and anyone else who has talked to me in person for any length of time about programming and other topics), I guess I'll put up another one:

If a programming language gives me lists, dictionaries, and a usable object model, I'm happy. Pretty much everything I want to do data-structure-wise can be done by putting lists and dictionaries together. The object model is there for those times when I can't easily shoehorn my idea into a list/dictionary monstrosity.

Obviously, anything cobbled together with lists and dictionaries will benefit from a refit into objects that more directly represent semantic operations, but the first cut at the data structure will probably be pure lists and dicts.

A minor corollary: If you are trying to create a data structure that is mostly a dictionary of dictionaries, you can probably simplify your code by using just one dictionary and using key composition. Yeah, that's probably written up somewhere as an official rule (and you do have to be smart about doing the composition to avoid invalid duplicate keys), but I've never seen it. It's something I learned to do all by myself. The obvious argument against this technique is that the dictionary will get huge, and the key lookup will get inefficient, but it takes a while before that's really an issue, and it does produce working code quickly.

10:46:27 AM    comments ()  trackback []