Created
August 21, 2011 01:47
-
-
Save mshroyer/1159980 to your computer and use it in GitHub Desktop.
Python example code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
class Room: | |
def __init__(self, name): | |
self.name = name | |
if __name__ == '__main__': | |
r = Room('FooRoom') | |
r.shortdesc = "Some short description" | |
r.longdesc = "And some slightly longer description" | |
# Just a fancy way of printing out the object's attributes... | |
for attr, value in r.__dict__.iteritems(): | |
print "r.%s = %s" % (attr, value.__repr__()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment