Sunday, 15 March 2015

python - Is utilizing simple metaclasses to allow subclasses to overload __init__ without having to call anything additional a good idea? -



python - Is utilizing simple metaclasses to allow subclasses to overload __init__ without having to call anything additional a good idea? -

some context:

i'm creating simple component-entity 2d game engine

vast bulk of classes have flat subclass hierarchies

pretty much base of operations classes don't require arguments

i'm using python 2

so, current solution, create __init__ of base of operations classes phone call overridable _on_init method, because having baseclass.__init__ strikes me unsightly, , having utilize super()

i'm not asking thoughts on practice(although means welcome), asking if there aren't pitfalls or other unpleasantries might subscribing myself to.

python instantiation metaclass

No comments:

Post a Comment