Created
February 14, 2013 15:45
-
-
Save jakab922/4953641 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 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