Monday, September 27, 2004

Stalling
On this same note that Programming Languages Are Slow To Develop in, I'm stalling right now because I don't want to write code in Python that routes every item from a list into it's appropriate object member function.

Take this list:

[1, "bob", pi]

Where the first item in the list needs to go into the object member isBulbLit, the second goes into bulbName, and the final into happyNumber.

I don't know how to do this easily. I could create a list of the members of the object, in the order they appear in the function, then use __getattr__ cleverly, but that seems like a lot of work to do something that should be easy (but I would only have to write it once, and there's appeal to that).