I think it would be logical to have the insert operator for lists. Similar to list extend operator += , it could use one of augmented assignment operators, e,g, /=.
L = ["aa"] L[0] /= "bb" -> ["bb", "aa"] L[0] /= [1,2] -> [[1,2], "aa"] etc. Without index it would work like append(): L /= "bb" #-> ["aa", "bb"] As for possible spellings I like this one as well: L[i] ^= e The proposed solution is meant to have insert() method semantics, plus it would cover append() method nicely. Insert and append are very frequent operations, so I wonder if there was already related suggestion? Is there some technical problem with implementing this? Note that there is a trick to 'insert' an element with slicing syntax, e.g.: L[0:0] = [[1,2]] -> [[1,2], "aa"] L[0:0] = ["bb"] -> ["bb", "aa"] The trick is to put brackets around the element and so it works as insert(). Though additional brackets look really confusing for this purpose, so I don't feel like using this seriously. M _______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/