Re: Re: Negative string offset support
| From: | Rasmus Lerdorf | Date: | Thu, 01 Jan 1970 00:00:00 +0000 |
| Subject: | Re: Re: Negative string offset support | ||
| References: | 1 2 3 4 5 6 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-13649@lists.php.net to get a copy of this message | ||
On Sun, 31 Oct 2004, moshe doron wrote:
> where the problem about 'taking it ever further'?
> I'm +1 for {-1} and more +1 for {-4,2} python likeness.
That starts getting confusing. I assume that translates to the 3rd and
4th chars from the end of the string. And, to verify that I went and
looked it up and it turns out that's not the case in Python. They use
[start_index:end_index] so [-4:2] would be the 4th char from the end until
the 2nd char in the string, so for a 6 char string or longer that would
return nothing, but worse, my initial guess at what it did was wrong. I
don't like features where my first guess at what something does is wrong.
-Rasmus