3 ms·
Python's slice/range semantics never occured to be really weird to me because half-open intervals [x,y) are widely used in measure theory textbooks.
by 331c8c71 3y ago
Python's slice/range semantics never occured to be really weird to me because half-open intervals [x,y) are widely used in measure theory textbooks.
- henearkr 3y agoHow hard can you continue to advocate for this way of asking like: "please count from 0 to 7 excluded"? Ask this to anybody in the street and they'll be confuse why you mentionned 7 if it's excluded! That's natural numbers, not reals! > measure theory First of all, even for a specialist, that extremely hard to be delusioned into thinking we're doing measure theory, when we're manipulating indices of arrays/matrices/tensors. But anyways, assuming you think it's measure theory. I'm trained in the field and that's impossible to expect half-open intervals in this particular place! To the contrary: the support of base elements of major functional spaces used in measure theory textbooks are always compacts.
- 331c8c71 3y ago> How hard can you continue to advocate ... That's natural numbers, not reals! I didn't mean to advocate at all... Just explained that I never peronally felt the weirdness of it. The point about integers is taken but Python style also gives you len(range(n, n+k)) == k and len(range(n, k)) == n - k which is very convenient at times. > To the contrary: the support of base elements of major functional spaces used in measure theory textbooks are always compact. You can take either type of intervals to define Borel sigma algebras. Half-open intervals, however, additionaly form a semiring while finite unions of half-open intervals additionaly form a ring - the starting point of Caratheodory's extension theorem [1] which is kind of essential at least in some expositions. [1]: https://en.m.wikipedia.org/wiki/Carath%C3%A9odory%27s_extension_theorem https://en.m.wikipedia.org/wiki/Carath%C3%A9odory%27s_extens...