Re: Why equal(x[n], x[n..n])=0 ?
- Posted by Jason Gade <jaygade at yah?o.c?m> Sep 25, 2007
- 720 views
Fernando Bauer wrote: > > Hi Pete, > > Pete Lomax wrote: > > > > Jason Gade wrote: > > > Because when you say s[3..3] you are saying, "bring me one item in a > > > bucket". > > > It's not mutually exclusive. You can carry one thing with or without the > > > bucket. > > > You can always take the item out of the bucket after it is brought to you. > > > > > I like that analogy. A slice asks for a bucket with n items in it. You've > > always > > got the bucket, whether it has 97, 4, 1, or 0 things in it. > > And a thing in a bucket is not the same as said thing not in a bucket. > And that is the problem! Sometimes you expect a thing out of the bucket and > you receive within the bucket. > > > > > Regards, > > Pete > Regards, > Fernando I understand what you are saying, and after a certain point the answer becomes "because that's the way it is!" Which is rarely satisfying to give or receive, but... I still think it adheres to the "principle of least surprise" anyway, unlike a few other aspects of the language. -- A complex system that works is invariably found to have evolved from a simple system that works. --John Gall's 15th law of Systemantics. "Premature optimization is the root of all evil in programming." --C.A.R. Hoare j.