Skip to content

Instantly share code, notes, and snippets.

@capttwinky
Created January 27, 2012 23:06
Show Gist options
  • Save capttwinky/1691452 to your computer and use it in GitHub Desktop.
Save capttwinky/1691452 to your computer and use it in GitHub Desktop.
How OO is python? ... it's objects, all the way down
#!/usr/bin/env python
# -*- coding: utf-8 -*-
def myFunction(**kwargs):
return attrSetter(myFunction,**kwargs)
def attrSetter(target,**kwargs):
for k,v in kwargs.iteritems():
setattr(target,k,v)
return True
def main():
myFunction(**{'a':'apple','b':'bonobo'})
print myFunction.a
print myFunction.b
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment