[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Comments System



I just created a logEvent method in my file_io lib, and I call it via if world.DEBUG: logEvent("className: %s" % (any important data)).  Logs it to a file, so it's faster than printing to a terminal.

Your method doesn't sound odd, though I'm wondering why you're passing 'what'.  I'd imagine that anything useful would be an attribute of self.

On 4/6/06, Kris Schnee <kschnee@xxxxxxxxxx> wrote:
I've gotten into the habit of putting the following code into most new
classes I create. Does it make sense, or is there a better way to
include the togglable debug messages I'm trying to make?

def Comment(self,what):
     if self.comments:
         print "["+self.name+"] "+str(what)

eg.:

>>> my_object.Comment(42)
[Name Of Object] 42




--
Andrew Ulysses Baker
"failrate"