Steven D'Aprano <[email protected]> added the comment:
> the programmer may use the variable __name__ for some other purposes
Dunder names like `__name__` are reserved for the use of the interpreter. If
the programmer uses them for "other purposes", the programmer is responsible
for any failures.
You wouldn't write:
class MyList(list):
__len__ = "Hello world!"
and then be surprised that MyList is broken. You shouldn't be surprised if
setting `__name__` to an invalid value breaks things either.
----------
nosy: +steven.daprano
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue47136>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com