[Python-Dev] python3k change to slicing (original) (raw)
Jon Ribbens jon+python-dev at unequivocal.co.uk
Thu Apr 19 20:03:56 CEST 2007
- Previous message: [Python-Dev] python3k change to slicing
- Next message: [Python-Dev] Win64, 64 Bit Version and 32 Bit version parallel install not possible
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Guido van Rossum <guido at python.org> wrote:
-1
Me too.
While this may be theoretically preferable, I believe that in practice changing this would be a major pain for very little gain. I don't recall ever finding a bug related to this feature, and I believe it's occasionally useful.
I find it quite frequently useful.
Here's something that would be much more cumbersome with your proposed change: suppose I have a string of unknown length and I want to get the first three characters, or less if it's not that long. Today I can write s[:3]. With your proposal I would have to write s[:min(3, len(s))].
... and that's exactly the sort of situation I find it useful ;-)
I certainly think it's easier to check that your result is the length you wanted on the occasions you need to, than it would be to make the replacement you show above everywhere else.
- Previous message: [Python-Dev] python3k change to slicing
- Next message: [Python-Dev] Win64, 64 Bit Version and 32 Bit version parallel install not possible
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]