![]() |
which exception should be thrown for a sequence of the wrong length? - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: which exception should be thrown for a sequence of the wrong length? (/thread-39131.html) |
which exception should be thrown for a sequence of the wrong length? - Skaperen - Jan-06-2023 which exception should be thrown for the case of passing, to a function, a sequence of the wrong length? TypeError and ValueError both seem wrong and there is no LengthError. RE: which exception should be thrown for ... - deanhystad - Jan-06-2023 ValueError, because there is an error with the value, wrong length, not the type. You can make your own exception classes. |