On Tue, Oct 5, 2010 at 8:59 AM, Michael Schultz <mich...@michael-schultz.net> wrote: > >> Have you read PEP 8? >> >> Your Common.Common class, which has two unrelated methods and no >> instance state, and is instantiated everywhere for a single use and then >> discarded, is not how we do things in Python land. What's wrong with a >> simple global function? > > > I only discovered PEP 8 recently, so I don't have it down. And I'm not sure > what you mean by "global function" I put it in a class so that I could access > it in the files that needed it. Is that not correct?
Well, the idea that you need to "put it in a class" in order to "access it in the files that needed it" is certainly not correct. You could do it that way, however like Marius says, that's a very strange usage. A more sensible usage could be: 1. Scrap the class, move the two functions out into the main scope of the 'Common' module (correspondingly removing the 'self' parameter) 2. Replace code like c = Common.Common() self.text, self.rect = c.draw_font(txt, color) with self.text, self.rect = Common.draw_font(txt, color) HTH.