Skip to content

Instantly share code, notes, and snippets.

@gvx
Created July 29, 2009 18:39
Show Gist options
  • Save gvx/158324 to your computer and use it in GitHub Desktop.
Save gvx/158324 to your computer and use it in GitHub Desktop.
#By Robin Wellner (gvx)
#I hereby waive copyright and related or neighboring rights to this work
#See the Creative Commons Zero Waiver at <http://creativecommons.org/publicdomain/zero/1.0/>
#a simple way to create one object without having to maintain it's class
#only works in Python 3.x
@apply
class oneObject:
x = 6
y = 'SPAM!'
def Monty():
return 'Python'
print(oneObject.x) #-> 6
print(oneObject.y) #-> SPAM!
print(oneObject.Monty()) #-> Python
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment