[Python-ideas] New list methods

Zac Burns zac256 at gmail.com
Tue May 5 19:17:51 CEST 2009


Jeremy is correct...

Sorry, there was a typo in the proposal.

This:
    "rremove: Return first occurence of value from the right."

Should read:
    "rremove:  Remove first occurence of value from the right."

The methods are 'inspired' by the similar 'r' methods of strings.

--
Zachary Burns
(407)590-4814
Aim - Zac256FL
Production Engineer (Digital Overlord)
Zindagi Games



On Tue, May 5, 2009 at 10:11 AM, Jeremy Banks <jeremy at jeremybanks.ca> wrote:
> I believe the proposal is to have l.rremove() take a value parameter,
> and remove the last occurrence of that value from the list, not just
> the last value in the list.
>
> My assumpting is that their basic functionality would work like this.
>
>    l = [1, 2, 3, 2, 1]
>    l.rindex(2) == 3
>    l.rremove(2)
>    l == [1, 2, 3, 1]
>
> I'd say +1.
>
> On 2009-05-05, Oleg Broytmann <phd at phd.pp.ru> wrote:
>> On Tue, May 05, 2009 at 09:25:16AM -0700, Zac Burns wrote:
>>> I would like to see the following methods added to lists...
>>>
>>> rindex : Return first index of value from the right
>>> rremove: Return first occurence of value from the right.
>>
>>    l.rremove() is the same as l.pop() or l.pop(-1)
>>
>> Oleg.
>> --
>>      Oleg Broytmann            http://phd.pp.ru/            phd at phd.pp.ru
>>            Programmers don't die, they just GOSUB without RETURN.
>> _______________________________________________
>> Python-ideas mailing list
>> Python-ideas at python.org
>> http://mail.python.org/mailman/listinfo/python-ideas
>>
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> http://mail.python.org/mailman/listinfo/python-ideas
>



More information about the Python-ideas mailing list