Created
July 29, 2009 18:39
-
-
Save gvx/158324 to your computer and use it in GitHub Desktop.
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
#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