Bug in string.find; was: Re: Proposed PEP: New style indexing,wasRe: Bug in slice type

Terry Reedy tjreedy at udel.edu
Sat Sep 3 16:56:24 EDT 2005


"Ron Adam" <rrr at ronadam.com> wrote in message 
news:dHnSe.2098$4i6.1732 at tornado.tampabay.rr.com...
> (I was wondering why list's couldn't have len,min, and max attribute
> that are updated when ever the list is modified in place of using
> len,min, and max functions?

Python's list and, I believe, other builtin roster objects do have a 
C-level length attribute.  For mutables, it is updated.  __len__ is just a 
get of int value the and conversion to int object.  Min and max are defined 
and sensible for only a subset of lists, and when they are, are very seldom 
need repeated updates.

> Would the overhead be that much?)

For the fraction of times used, yes.

Terry J. Reedy






More information about the Python-list mailing list