[issue37623] namedtuple integration for importlib.abc.Loader
Andrew Yurisich
report at bugs.python.org
Fri Jul 19 16:25:38 EDT 2019
Andrew Yurisich <andrew.yurisich at nbx.com> added the comment:
You're right, I was invoking the namedtuple on the same line that I was
defining it, freezing it in the process.
I split it to into two statements, and snuck the __spec__ attribute between
the definition and the instantiation.
I'll update the examples on my GitHub issue in the morning, and probably
close the issue out unless I find something else that is blocking me.
Thanks for the input 👍
On Fri, Jul 19, 2019, 22:08 Serhiy Storchaka <report at bugs.python.org> wrote:
>
> Serhiy Storchaka <storchaka+cpython at gmail.com> added the comment:
>
> It is not hard to set __spec__ (as well as any other attributes) after
> creating a namedtuple class.
>
> A = namedtuple(...)
> A.__spec__ = ...
>
> or
>
> class A(namedtuple(...)):
> __spec__ = ...
>
> __spec__ do not have anything to namedtuple. It is not like __module__ or
> __doc__ setting which would benefit almost every public namedtuple class.
> It is not even special for types.
>
> ----------
> nosy: +serhiy.storchaka
>
> _______________________________________
> Python tracker <report at bugs.python.org>
> <https://bugs.python.org/issue37623>
> _______________________________________
>
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue37623>
_______________________________________
More information about the Python-bugs-list
mailing list