[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [pygame] Comments System
- To: pygame-users@xxxxxxxx
- Subject: Re: [pygame] Comments System
- From: "andrew baker" <failrate@xxxxxxxxx>
- Date: Thu, 6 Apr 2006 19:37:33 -0700
- Delivered-to: archiver@seul.org
- Delivered-to: pygame-users-outgoing@seul.org
- Delivered-to: pygame-users@seul.org
- Delivery-date: Thu, 06 Apr 2006 22:37:38 -0400
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; b=lPG02aATa2Ynq9kNDlnheG3FCfZDqEKqRUZAJ8Likq4iG5DcFmOaVZvFvDCg+FeWRYVSLtbrItzQMzkLsJkPddmqGb/YmiQO19wh6vHoc3Xq6GlZWADftYZPgQSYwyavZ+pD4ROaPwzzqsn9GxUbC4P8zt4DvcOv9UOAIrJgKlQ=
- In-reply-to: <4435A76A.4080503@xepher.net>
- References: <4435A76A.4080503@xepher.net>
- Reply-to: pygame-users@xxxxxxxx
- Sender: owner-pygame-users@xxxxxxxx
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"