Implementing prototypes OR instantiating class objects

Posted by intuited on Stack Overflow See other posts from Stack Overflow or by intuited
Published on 2010-06-15T04:28:40Z Indexed on 2010/06/15 4:32 UTC
Read the original article Hit count: 146

I'm wondering how to implement prototypal inheritance in Python. It seems like the way to do this would be to either

  • use a metaclass to cause instantiations to actually be classes, rather than objects, or

  • use some magical powers to transform an existing object into a class.

The second method would seem to be more flexible, in that it could be applied to existing objects of varied types, while the first would likely be more convenient for typical use cases.

Insights on the practicality of these two approaches, as well as alternative suggestions, are hereby requested.

© Stack Overflow or respective owner

Related posts about python

Related posts about prototypal-inheritance