[issue11674] list(obj), tuple(obj) swallow TypeError (in _PyObject_LengthHint)

Elvis Pranskevichus report at bugs.python.org
Fri Mar 25 23:45:11 CET 2011


Elvis Pranskevichus <elprans at gmail.com> added the comment:

I think that explicitly raising TypeError in __len__() is wrong in any case.  I would argue something like NotImplementedError is a better choice to signal the absence of length.  Which also makes me think that Python's exceptions are, maybe, too coarse sometimes.

----------
versions: +Python 2.5, Python 2.6, Python 2.7, Python 3.1, Python 3.2

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


More information about the Python-bugs-list mailing list