Re: Python Enhancement Proposal for List methods

2018-10-23 Thread Bob Gailer
Many of the features of python were added not out of need but rather for convenience. If need were the only criteria we could immediately get rid of comprehensions, since they can be written as a series of for loops, the same can be said for many other newer features. Python is all about making

RE: Python Enhancement Proposal for List methods

2018-10-22 Thread Schachner, Joseph
AM To: python-list@python.org; python-id...@python.org Subject: Python Enhancement Proposal for List methods Hey everyone, I am really new to Python contribution community want to propose below methods for List object. Forgive me if this is not the format to send an email. 1. *list.replace

Re: Python Enhancement Proposal for List methods

2018-10-22 Thread Chris Angelico
On Mon, Oct 22, 2018 at 11:20 PM Lutz Horn wrote: > > On Sun, Oct 21, 2018 at 06:06:40PM +0530, Siva Sukumar Reddy wrote: > > 1. *list.replace( item_to_be_replaced, new_item )*: which replaces all the > > occurrences of an element in the list instead of writing a new list > > comprehension in

Re: Python Enhancement Proposal for List methods

2018-10-22 Thread Lutz Horn
On Sun, Oct 21, 2018 at 06:06:40PM +0530, Siva Sukumar Reddy wrote: > 1. *list.replace( item_to_be_replaced, new_item )*: which replaces all the > occurrences of an element in the list instead of writing a new list > comprehension in place. Try this: >>> l = [1, 3, 4, 5, 6, 5, 4, 3, 2, 1] >>>

Re: Python Enhancement Proposal for List methods

2018-10-22 Thread Peter Otten
Siva Sukumar Reddy wrote: > I am really new to Python contribution community want to propose below > methods for List object. Forgive me if this is not the format to send an > email. > > 1. *list.replace( item_to_be_replaced, new_item )*: which replaces all the > occurrences of an element in the

Python Enhancement Proposal for List methods

2018-10-22 Thread Siva Sukumar Reddy
Hey everyone, I am really new to Python contribution community want to propose below methods for List object. Forgive me if this is not the format to send an email. 1. *list.replace( item_to_be_replaced, new_item )*: which replaces all the occurrences of an element in the list instead of writing