[Python-ideas] get() method for list and tuples

Ethan Furman ethan at stoneleaf.us
Sun Mar 5 21:44:08 EST 2017


On 03/05/2017 11:13 AM, Ed Kellett wrote:
> I'm not trying to get anyone to implement list.get, I'm trying to get it centrally
 > documented and allowed into list's overly-mappingproxied namespace.

--> dir(list)
# non dunder methods
'append', 'clear', 'copy', 'count', 'extend', 'index', 'insert', 'pop', 'remove', 'reverse', 'sort'

--> dir(dict)
# non dunder methods
'clear', 'copy', 'fromkeys', 'get', 'items', 'keys', 'pop', 'popitem', 'setdefault', 'update', 'values'

I will admit I'm not entirely sure what you meant with that last statement, but it sounds like you think `list` has a 
bunch of the same methods as `dict` does.  I count 11 methods on dict, 11 methods on list, and only 3 methods that are 
shared (1 of which doesn't work precisely the same on both).

So I'm not seeing a bunch of similarity between the two.

And I'm not seeing any progress here in this discussion, so I'm dropping out now.

--
~Ethan~


More information about the Python-ideas mailing list