3 ms·
Python has much more sensible range operations (based on slice syntax for array slices, or the arguments to the build-in 'range' function) that are unrelated to
by jacobolus 12y ago
Python has much more sensible range operations (based on slice syntax for array slices, or the arguments to the build-in 'range' function) that are unrelated to this.
Ruby (and coffeescript, and perhaps perl) uses a..b to indicate a closed range (i.e. including b), or a...b to indicate a half-closed range (not including b). Swift seems to do the opposite. My guess for how ruby (or predecessors) came up with this was by copying bash (or sh?), which has only the .. version.
To be honest, the .. vs. ... distinction is really confusing and error-prone, and a bad bit of syntax to include in any language, period.
- andybak 12y agoFirst thing I looked for in Swift was support for Python's slicing syntax. It's a shame they decided against using that.