[Python-ideas] A (meta)class algebra (original) (raw)
Thomas Kluyver thomas at kluyver.me.uk
Thu Feb 12 19:35:23 CET 2015
- Previous message: [Python-ideas] A (meta)class algebra
- Next message: [Python-ideas] A (meta)class algebra
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 12 February 2015 at 05:42, Martin Teichmann <lkb.teichmann at gmail.com> wrote:
With my addition, one could simply add a method to MetaRegistrar:
def add(self, other): class Combination(self, other): pass return Combination
Having recently had to refactor some code in IPython which used multiple inheritance and metaclasses, -1 to this idea.
- More magic around combining metaclasses would make it harder to follow what's going on. Explicit (this has a metaclass which is a combination of two other metaclasses) is better than implicit (this has a metaclass which can combine itself with other metaclasses found from the MRO).
- I want it to be hard for people to write multiple-inheriting code with multiple metaclasses. That code is most likely going to be a nightmare for anyone else to understand, so I want the person creating it to stop and think if they can do it a different way, like using composition instead of inheritance.
Thomas -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-ideas/attachments/20150212/5339c43d/attachment.html>
- Previous message: [Python-ideas] A (meta)class algebra
- Next message: [Python-ideas] A (meta)class algebra
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]