-
-
Save girasquid/1392496 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
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') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Chiggity Czech: https://gist.github.com/1392496