Re: listreverse

Guido.van.Rossum@cwi.nl
Tue, 20 Sep 1994 13:46:09 +0200

> Why isn't listreverse() non-static so that it can be used in the same
> way as sortlist(), newlistobject(), getlistsize(), getlistitem(),
> inslistitem(), addlistitem(), getlistslice(), etc....
>
> was this an oversight? Why is this piece of functionality not exposed?

Why, why, why... listreverse() (like listsort()) expects its
arguments to be in the format by which all built-in methods are
called: 'self' guaranteed to be a list object and 'args' the Python
argument list. sortlist() (note reversed name) is intended to be
called from C, checks its 'self' argument and diesn't have a second
argument. It's trivial to write a C-callable wrapper for
listreverse() -- it's just bot been done because I never thought
anybody would want this functionality from C.

> Is there any other way to access the reverse function from within a C
> module that I'm overlooking?

I suppose that you could do it using the call_method() function I
proposed in a previous mail.

--Guido van Rossum, CWI, Amsterdam <mailto:Guido.van.Rossum@cwi.nl>
<http://www.cwi.nl/cwi/people/Guido.van.Rossum.html>