On Tue, 07 Feb 2006 22:32:40 +0100, Fredrik Lundh wrote: > are you sure you know Python ?
Oh my, a little tetchy today aren't we? Obviousness is a subjective matter! It is one thing to say that 9 out of 10 programmers not only discover this technique (by reading the tutorial perhaps) but remember it, and therefore it is not an issue. It is another issue altogether to say "When I want to CLEAR a list, I think of DELETING A SLICE, and anyone who doesn't obviously doesn't know Python." As for the earlier suggestion that it would be obvious if only I'd done the tutorial, if you need to be taught something it is hardly obvious is it? Otherwise "obvious" loses all meaning, and we can say any feature, no matter how obscure, is obvious if only you'd read the right book, had the right teacher, taken the right college degree. I understand that get/set/del of slices is absolutely fundamental to lists. I understand that lists are not precisely the same as dicts. I understand that if you read help(list) and see the entry for the __del__ method and extrapolate sufficiently you will come up with del L[:] as a technique for clearing a list. But I also see that Python includes convenience methods, like pop and extend and insert, and it is my opinion is that Python's clarity would be slightly increased if lists had a clear() method. That's a very mild claim, and I don't understand why there is so much vehemence against the suggestion. It's not like I suggested Python should get rid of slicing altogether. If it is just "I've had a bad week and I'm grumpy", then I can understand that -- I've been there and done that. If it's "I hate the word 'clear' and it fills me with rage that dicts have a clear method too", then I'll just back away slooowly now. But if there are good, solid reasons for rejecting *this particular* (hypothetical) convenience method, then I'd like to hear about them, sans questions about my ability to program in Python. Thank you, -- Steven. -- http://mail.python.org/mailman/listinfo/python-list