Skip to content

Instantly share code, notes, and snippets.

@mdippery
Created February 1, 2014 01:31
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 mdippery/8746653 to your computer and use it in GitHub Desktop.
Save mdippery/8746653 to your computer and use it in GitHub Desktop.
Random subclass, Python style
#!/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