[Python-ideas] proposed methods: list.replace / list.indices

Steven D'Aprano steve at pearwood.info
Mon Dec 31 02:39:18 CET 2012


On 31/12/12 01:10, Ned Batchelder wrote:

> What is the organizing principle for the methods list (or any other
>built-in data structure) should have? I would hate for the main
>criterion to be, "these are the methods that existed in Python 2.3,"
> for example. Why is .count() in and .replace() out?

I fear that it is more likely to be "they existed in Python 1.5".

As far as I can tell, there have been very few new methods added to standard
types since Python 1.5, and possibly before that. Putting aside dunder methods,
the only public list methods in 3.3 that weren't in 1.5 are clear and copy.
Tuples also have two new methods, count and index. Dicts have seen a few more
changes:

- has_key is gone;
- fromkeys, pop, popitem, and setdefault are added.


So changes to builtin types have been very conservative.



-- 
Steven



More information about the Python-ideas mailing list