[Python-Dev] Patches

Thomas Wouters thomas@xs4all.net
Tue, 18 Jul 2000 16:59:46 +0200

On Tue, Jul 18, 2000 at 11:11:57AM -0400, esr@thyrsus.com wrote:

> > - arraymodule: adding count, extend, index, pop, remove
> > I believe there was some discussion about this before, don't know the
> > outcome.
> Is there a PEP?  I suspect from looking at the names that I would
> be +0 on this, but I wonder why pop() and no push()?

No PEP, it's pre-PEP. The methods names are not in question, because they
mirror the current *list* method names ;) and push() is spelled 'append()'
in Python. Here's what pop() does:

>>> x = [1,2,3,4,5]      
>>> x.pop()
>>> x
[1, 2, 3, 4]

The question is mostly whether count(), index() and maybe remove() are worth
adding to the arrayobject, given their inefficient implementation.

(An efficient implementation would require a fair bit of code, but on the
plus side, that same code could then be used for 'sq_contains', which
currently is appallingly inefficient.)

Thomas Wouters <thomas@xs4all.net>

Hi! I'm a .signature virus! copy me into your .signature file to help me spread!