On Mon, Oct 14, 2019 at 1:34 AM David Mertz <me...@gnosis.cx> wrote: > This put a certain thumb on the scale since I searched for .append() which > will automatically only find lists. Or maybe it's a deque. Or something > else. I don't actually know for sure (but I kinda think the programmers who > did this wouldn't have used something more "exotic"). >
I guess the (Python) language is pretty consistent in this particular case that it calls the same things same and the different things different. E.g. `remove` and `pop` have the same meaning for a list or a set, but `append` does not. What would "generic" `add` defined for a list-or-set do exactly on the list? Append, insert, and if the latter, where exactly? In your code, if you do not care about the type and just need one common 'add' then you either are using sets (even if they are not Python sets, but lists, queues, etc. you are using them as sets), or you need to specify, whether this 'add' actually appends, or inserts and then it is no longer just a generic 'add'. Richard
_______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/XPE7JZYT2U5SPBGD7TN3PPLYFX45RZLE/ Code of Conduct: http://python.org/psf/codeofconduct/