--- 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. _______________________________________________ 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