On Sun, Nov 16, 2014 at 4:25 PM, <[email protected]> wrote:
> When super().__init__() is called, a 'magic' local appears in frame.f_locals
> called '__class__'. Helpfully, it has the correct class for the context,
> which will differ from type(self). (I discovered this magic local by poking
> around in the debugger. I am unable to find any official documentation on
> it.)
>
Interesting. Are you sure you can't get the class name via the
function, rather than depending on this magic local? That seems
fragile.
Your example code isn't currently runnable ("def class"); can you
provide a self-contained program that actually attempts to display
something? It'd be helpful for those of us who aren't familiar with
internal and esoteric details of tracebacks and __init__ :)
ChrisA
--
https://mail.python.org/mailman/listinfo/python-list