Created
February 1, 2014 01:31
-
-
Save mdippery/8746653 to your computer and use it in GitHub Desktop.
Random subclass, Python style
This file contains 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
#!/usr/bin/env python | |
import random | |
cls = random.choice([list, dict, str, int, float]) | |
class RandomSubclass(cls): | |
def __str__(self): | |
return "MRO: %s" % (RandomSubclass.__mro__,) | |
x = RandomSubclass() | |
print x |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment