Skip to content

Instantly share code, notes, and snippets.

@girasquid
Forked from kylefox/clunky.py
Created November 24, 2011 23:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save girasquid/1392496 to your computer and use it in GitHub Desktop.
Save girasquid/1392496 to your computer and use it in GitHub Desktop.
class MyThing(object):
def save(self, *args, **kwargs):
# If only I could `my_kwarg = kwargs.delete('my_kwarg')
my_kwarg = kwargs.pop('my_kwarg', False)
print "did some things"
# result = super(SpecialThing, self).save(*args, **kwargs)
if my_kwarg:
print "did other things, because of the kwarg"
# self.do_more_stuff()
return
foo = MyThing()
foo.save()
foo.save(my_kwarg='bar')
@girasquid
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment