elegance

Elegant Solution?

Elegant Solution Hey People. I'm currently working on a Project and I am thinking of an elegant solution for the implementation, I'm tired of improvised solutions. Let me try to explain my "Problem" to you: The task of this part of my app is pretty simple: I want my app to download some stuff and process that downloaded file in the ...

coding style: use parameter or instance variable?

I often have functions which take a parameter, set an instance variable to that parameter, and then do other things, e.g.: def updateFoo(self, foo): self.foo = foo fooProcessor1(foo) fooProcessor2(self.foo) Do you prefer to pass the parameter itself, as in fooProcessor1, or the newly-set instance variable, as in fooProcess...

Private inheritance and swap

I'm using private inheritance in the implementation of two very related classes. The using Base::X; is very useful and elegant. However, I can't seem to find an elegant solution for reusing the base class's swap function. class A { public: iterator begin(); const_iterator begin() const; const_iterator cbegin() const; ...

good refactoring or bad?

Given the following code: status = row[COL_STATUS] if status == "idle": row[COL_EDITABLE] = True row[COL_FONTSTYLE] = pango.STYLE_NORMAL row[COL_WEIGHT] = pango.WEIGHT_NORMAL elif status == "DCed": row[COL_EDITABLE] = True row[COL_FONTSTYLE] = pango.STYLE_ITALIC row[COL_WEIGHT...