[issue41403] Uncaught AttributeError in unittest.mock._get_target

Andrei Kulakov report at bugs.python.org
Sat Jan 1 14:05:29 EST 2022


Andrei Kulakov <andrei.avk at gmail.com> added the comment:

More generally, split()/rsplit() are probably the most common operations done on expected string at the start of a function, i.e. most likely to be triggered on the wrong type passed in. At the same time to many new users split()/rsplit() does not imply anything related to strings, and 'split' sounds too generic to expect explanatory results from google search. (although the first few results do point to the right explanation, and rsplit does seem like something that would return helpful search results).

I wonder if it would be helpful, especially for .split() (and rsplit for consistency), to add to the error msg: "... it's likely that a string object was expected instead of <type> object".

----------
nosy: +andrei.avk

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


More information about the Python-bugs-list mailing list