Created
September 30, 2010 05:31
-
-
Save fish2000/604081 to your computer and use it in GitHub Desktop.
example of python closures
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
def cl_get(what=None): | |
def cl(self, yodogg): | |
print u"cl_get(what): %s" % what | |
print u"cl.func_name: %s" % cl.func_name | |
print u"cl(self) type: %s" % type(self) | |
print u"cl(yodogg): %s" % yodogg | |
return cl | |
class Stuff(Thingy): | |
@staticmethod | |
def stuffing(): | |
def mystuff(stuffit, *args, **kw): | |
print "I STUFFED IT: %s" % stuffit | |
return mystuff |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment