Skip to content

Instantly share code, notes, and snippets.

@kylefox
Created November 24, 2011 23:07
Show Gist options
  • Save kylefox/1392484 to your computer and use it in GitHub Desktop.
Save kylefox/1392484 to your computer and use it in GitHub Desktop.

Revisions

  1. kylefox created this gist Nov 24, 2011.
    11 changes: 11 additions & 0 deletions clunky.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,11 @@
    class SpecialThing(Thing):

    def save(self, *args, **kwargs):
    # If only I could `my_kwarg = kwargs.delete('my_kwarg')
    my_kwarg = 'my_kwarg' in kwargs
    if my_kwarg:
    kwargs.pop('my_kwarg')
    result = super(SpecialThing, self).save(*args, **kwargs)
    if my_kwarg:
    self.do_more_stuff()
    return result