Eric V. Smith <e...@trueblade.com> added the comment:

I think using a dataclass here would be easier, since you can control class 
variables. Is there some reason that your loader must be a namedtuple?

Something like:

from typing import ClassVar
from dataclasses import dataclass

@dataclass
class MyLoader:
    __spec__: ClassVar["Any"] = None
    name: str

l = MyLoader('test')

I'm not sure of the actual type of __spec__, I'm just using "Any" as a 
convenient placeholder. I'm also not sure if your intention is to inherit from 
importlib.abc.Loader, but that's easy enough.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue37623>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to