On Wed, Jan 27, 2010 at 4:55 PM, Steve Howell <showel...@yahoo.com> wrote:
> --- On Wed, 1/27/10, John Arbash Meinel <john.arbash.mei...@gmail.com> wrote:
>
>> From: John Arbash Meinel <john.arbash.mei...@gmail.com>
>> Subject: Re: [Python-Dev] patch to make list.pop(0) work in O(1) time
>> To: "Steve Howell" <showel...@yahoo.com>
>> Cc: "Guido van Rossum" <gu...@python.org>, "Nick Coghlan" 
>> <ncogh...@gmail.com>, python-dev@python.org
>> Date: Wednesday, January 27, 2010, 7:45 AM
>>
>> > Right now the Python programmer looking to
>> aggressively delete elements from the top of a list has to
>> consider the tradeoff that the operation takes O(N) time and
>> would possibly churn his memory caches with the O(N) memmove
>> operation.  In some cases, the Python programmer would
>> only have himself to blame for not using a deque in the
>> first place.  But maybe he's a maintenance programmer,
>> so it's not his fault, and maybe the code he inherits uses
>> lists in a pervasive way that makes it hard to swap in deque
>> after the fact.  What advice do you give him?
>> >
>>
>> Or he could just set them to None.
>
> Fair enough, but that's still wasteful of memory, keeping around a bunch of 
> None elements because you can't inexpensively delete them.  I concede that 
> you can break the dangling references, though, and that's often where large 
> programs waste a lot of memory, so your point is well taken.
>

Why is this thread still going? It seems to me that the case for this
change is very weak. Lists, like dicts and tuples, are used
*everywhere* and in *vast* quantities. Making them grow by 4 or 8
bytes each for such a corner case can't be an option.

I'm sure your new list class has a lot of uses, but it should be an
external class. If it stays close in behavior to the lists' behavior,
then we could even add a notice in pop()'s documentation that
recommends to use your new class in case they want a painless way to
replace list usage (to make the life of those poor developers
maintaining other people's code easier), maybe even add it in stdlib's
"collections" unit.

--
Virgil Dupras
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to