Raymond Hettinger wrote: > Cons: > ----- > * learning slices is basic to the language (this lesson shouldn't be > skipped)
And yet it doesn't appear to be in the tutorial. I could have missed it, but I've looked in a number of the obvious places, without actually going through it (again) from start to finish. Also, googling for "slice site:docs.python.org", you have to go to the *sixth* entry before you can find the first mention of "del x[:]" and what it does. I think given the current docs it's possible to learn all kinds of things about slicing and still not make the non-intuitive leap that "del x[slice]" is actually how you spell "delete contents of list in-place". > * while there are valid use cases for re-using lists, the technique is > already overused for unsuccessful attempts to micro-optimize (creating > new lists is surprisingly fast) Not just valid use-cases, but ones for which "x = []" is entirely buggy, yet not obviously so, especially to newcomers. > * the request is inane, the underlying problem is trivial, and the > relevant idiom is fundamental (api expansions should be saved for rich > new functionality and not become cluttered with infrequently used > redundant entries) The first phrase is insulting and untrue, the second merely untrue (as even your own list of pros and cons shows), and the last completely valid and highly relevant, yet not overriding. -Peter -- http://mail.python.org/mailman/listinfo/python-list