[issue19257] Sub-optimal error message when importing a non-package

Antoine Pitrou report at bugs.python.org
Fri Mar 14 12:52:37 CET 2014


Antoine Pitrou added the comment:

> If you only had the latter exception all you would know is Python
> doesn't consider datetime a package but you wouldn't know why that is 
> unless you knew the exact definition (the __path__ attribute exists). 
> Having the former exception helps make that a bit more obvious if you 
> didn't already know it.

I don't think someone who doesn't know about __path__ would be very enlightened by the error message. Also, I don't think error messages have a role in teaching about the implementation details of features, so I'd vote for removing the __context__ here.

----------
nosy: +pitrou

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue19257>
_______________________________________


More information about the Python-bugs-list mailing list