"Dennis Lee Bieber" <[EMAIL PROTECTED]> escribió en el mensaje news:[EMAIL PROTECTED]
> > I don't think l[:5] + l[5:] = l is a handy property > > and to me is clearly counterintuitive. Further, [snipped in the reply] Please, don't remove parts of my post which are relevant to the discussion. I said: >Further, >I don't understand why l[a:b] has a behaviour which >does't depend on its own logic but on that of certain >constructs containing slices but which aren't the >slices themselves. You give a counterexample: > st = "This i a string with typo, for example" > pos = st.find("i ") + 1 # "+ 1" to get the space after "i" > new_st = st[:pos] + "s" + st[pos:] but that shows clearly what I was saying -- this tricky syntax means that you have not to write st[:pos-1] in this particular code (but you still have to "write" it in your mind since it forms part of the logic of the problem). These kind of hacks look perlish to me. Of course, the danger of being off-by-one would be still present, but I would like to note that if you change the syntax to avoid it in some expressions you will find problems in another expressions where otherwise it wouldn't be present (counting from the end with negatives values is particularly funny). The same applies if the first element is 1 instead of 0, for example. Then, why not to leave that to the logic of the problem and not to tricky syntaxes? A pity, given that Python has a quite straighforward syntax. Javier -- http://mail.python.org/mailman/listinfo/python-list