Maniac wrote: > > Joseph Kocherhans wrote: > >> http://code.djangoproject.com/wiki/ModelInheritance >> >> This is still really rough. I hope I didn't leave too much out. Let >> the arguing commence ;-) >> >> > If the last bit ("Change the current usage of subclassing") is only > about removing inherited attributes why not do it this way: > > class MyArticle(Article): > del Article.field1 > del Article.field2 > ... >
Removing inherited attributes (IE removing database fields) breaks the ability to share an identity domain for the inheritance tree. This is a requirement for any vaguely sane subtyping relationship. The subtyping in trunk just isn't subtyping in any meaningful sense, it is definition copying, which is something far less useful. All the sane use cases so far also seem to rely on replaces_module, which no longer means anything in magic-removal. That aside, a plain reading of your suggestion would suggest that you are deleting the attributes from the parent class. You might be able to cobble this together to work in the entirely unintuitive way you suggest with a __del__ in the Field class and a module global list which is checked in the metaclass. I wouldn't recommend it though - it sounds immensely confusing.