[issue46170] Improving the error message when subclassing NewType

Gobot1234 report at bugs.python.org
Sun Dec 26 11:28:21 EST 2021


Gobot1234 <gobot1234yt at gmail.com> added the comment:

> Do you have evidence that people make this particular mistake often? And that the suggested solution is indeed what they should use? Why would you want to subclass UserId?

I was just trying to implement something that I thought had a non-obvious error message and isn't necessarily initially obvious if you have the idea that NewType creates a new type/class. The documentation suggests this is what you should be doing instead of subclassing it
https://github.com/python/cpython/commit/342e800e974475cc302c46ed6d9f75276035278f#diff-8a0f115fde6769c122b771b6d0eca184c4580f7b5fabe2f0b0579c679424364fR101-R113

> Do we have examples of other error messages split across two lines like this?

No if you want me to remove it thats fine by me.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue46170>
_______________________________________


More information about the Python-bugs-list mailing list