registering subclasses in python and ruby