akira added the comment: If `len()` signature can't be changed to return Python int objects (unlimited) then the OverflowError may contain the actual `.length` property instead (based on msg66459 by Antoine Pitrou)
operator.length(): def length(sized): """Return the true (possibly large) length of `sized` object. It is equivalent to len(sized) if len doesn't raise OverflowError i.e., if the length is less than sys.maxsize on CPython; otherwise return OverflowError.length attribute """ try: return len(sized) except OverflowError as e: return e.length ---------- nosy: +akira _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue21444> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com