Skip to content

Instantly share code, notes, and snippets.

@mshroyer
Created August 21, 2011 01:47
Show Gist options
  • Save mshroyer/1159980 to your computer and use it in GitHub Desktop.
Save mshroyer/1159980 to your computer and use it in GitHub Desktop.
Python example code
#!/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