why python cache the string > 256?

2009-10-26 Thread s7v7nislands
hi all: test.py #!/usr/bin/python a = [] for i in xrange(100): a.append('a'*500) $python -i test.py #virt mem 514m in top output >>del a #virt mem 510m why python cache these string? In source, I see when object size > SMALL_REQUEST_THRESHOLD, python would use mall

Re: why python cache the string > 256?

2009-10-26 Thread s7v7nislands
On Oct 27, 4:03 am, "Diez B. Roggisch" wrote: > s7v7nislands schrieb: > > > > > hi all: > > > test.py > > #!/usr/bin/python > > a = [] > > for i in xrange(100): > >     a.append('a'*500) > > > $python -i test.

s.index(x[, i[, j]]) will change the s ?

2009-09-09 Thread s7v7nislands
hi all: what is the s.index() mean? does the index() change the s? In python2.6 doc (6.6.4. Mutable Sequence Types), Note 4: Raises ValueError when x is not found in s. When a negative index is passed as the second or third parameter to the index() method, the list length is added, as for

Re: s.index(x[, i[, j]]) will change the s ?

2009-09-09 Thread s7v7nislands
Thanks for your reply! Sorry for my poor english! On Sep 10, 12:33 pm, Chris Rebert wrote: > On Wed, Sep 9, 2009 at 9:00 PM, s7v7nislands wrote: > > hi all: > >    what is the s.index() mean? does the index() change the s? > > It tells you the index of the first instance of