Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@jakab922
Created February 14, 2013 15:45
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 jakab922/4953641 to your computer and use it in GitHub Desktop.
Save jakab922/4953641 to your computer and use it in GitHub Desktop.
class MetaA(type):
def __call__(cls, *args, **kwargs):
for name, class in cls.__dict__.iteritems():
if issubclass(class.__class__, B):
# Do something
return # class A with modified fields
class B(object):
....
class A(object):
__metaclass__ = MetaA
abra = B(....)
kadabra = B(....)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment