Ha, snap - I just ran into the the same issue with VR-4. Initially using
reload for faster development, then in the way the core module loads the view
modules. imp.load_module also acts as a reload. Using reload for dev. aside,
my problem was descending the markdown view module from the html view module.
When the main module used imp.load_module to load the html module, super broke.
And it's not really super, it's any attempt to call the base class, even
directly.
I wonder if it could be avoided by
from amodule import AClass
class MyClass(AClass):...
instead of
import amodule
class MyClass(amodule.AClass):...
? maybe not, depends how AClass refers to its module.
Anyway, I gave up on reload for dev., and used exec "import amodule" where
needed for dynamic imports.
Cheers -Terry
From: Edward K. Ream <[email protected]>
To: leo-editor <[email protected]>
Sent: Thursday, February 9, 2017 8:37 AM
Subject: Re: Warning: imp.reload hurts super and TDD
On Thursday, February 9, 2017 at 8:29:56 AM UTC-6, Edward K. Ream wrote:
> Leo's TDD design involves imp.reload. Alas, imp.reload affects super
> calls!...
> This kind of pattern verges on the intolerable. The python 2 part is a
> revolting mess.
In fairness to python 2, the problems only arise when using imp.reload. When
imp.reload isn't involved, this works for Python 2 or 3:
super(ChildClass, self).__init__(args to ctor)
And if using only Python 3:
super().__init__(args to ctor)
However, this is scant comfort. imp.reload is so useful during development.
Edward
--
You received this message because you are subscribed to the Google Groups
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.