Skip to content

Instantly share code, notes, and snippets.

@jacob414
Created September 21, 2011 13:02
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 jacob414/1231969 to your computer and use it in GitHub Desktop.
Save jacob414/1231969 to your computer and use it in GitHub Desktop.
Subclass via function in Python
def subclass(Cls, name=None):
class _(Cls):pass
_.__name__ = name or 'subclass'
return _
@jacob414
Copy link
Author

Handy when you want to create large amounts of simple permutations from a base class.

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