[Python-3000] Should len() clip to sys.maxsize or raise OverflowError?
Daniel Stutzbach
daniel at stutzbachenterprises.com
Tue Sep 2 20:14:30 CEST 2008
On Tue, Sep 2, 2008 at 12:26 PM, Guido van Rossum <guido at python.org> wrote:
> I stand by my view. I might voice strong discomfort with raising an
> exception because it doesn't fit in some implementation detail.
Isn't that precisely what OverflowError is for? ("it doesn't fit in some
implementation detail")
It seems to me that the Purity angle here would be to allow len() to return
any Python int object. The Practical angle wants to restrict it to
sys.maxsize for performance reasons. Throwing an OverflowError seems like a
good way for Practical to cry, "Oops, I've been caught".
(I'm interested in this issue because my list-like extension
type<http://stutzbachenterprises.com/blist>can in some cases have a
length greater than sys.maxsize)
--
Daniel Stutzbach, Ph.D.
http://stutzbachenterprises.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-3000/attachments/20080902/159cdb9e/attachment.htm>
More information about the Python-3000
mailing list