Closed LivInTheLookingGlass closed 7 years ago
Probably the biggest problem is that using the other inheritance order doesn't actually work at all. In Python3, this will raise an Exception on import:
class Example(object, EventEmitter):
def __init__(self):
"""This is gross, and can cause MRO errors"""
object.__init__(self)
EventEmitter.__init__(self)
Good catch! I'm surprised I wasn't already inheriting from object.
Maybe not critical, but how would you feel about adding a test for inheritance?
Sure. Shouldn't be too hard.
On February 7, 2017 5:20:49 PM EST, Joshua Holbrook notifications@github.com wrote:
Good catch! I'm surprised I wasn't already inheriting from object.
Maybe not critical, but how would you feel about adding a test for inheritance?
-- You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub: https://github.com/jfhbrook/pyee/pull/32#issuecomment-278161240
Tests now passing. Tests that object
and EventEmitter
are in the MRO, and tests that it can still instantiate after a lengthy inheritance chain.
Released in 3.0.2 !
Thanks!
Right now I need to inherit from both EventEmitter and object if I want to build off of your class.
If you inherit from object, then I don't need to manage multiple inheritance. It's the difference between
and