DataFrames: why is `df[2,]` the same as `df[2]`?

This wasn’t intended as a shut down – it’s to prevent you from wasting your time opening an issue for something that isn’t going to happen. To put this in perspective:

  1. This would be a very disruptive change – a lot of code in the wild would need to be fixed, much of which is not on GitHub and therefore cannot be automatically updated.
  2. This is a very R-specific feature that no other mainstream language I’m aware of has.
  3. In the five years that Julia has been public, I don’t think this has ever come up before.
  4. This is very much the 11th hour. Julia has been under development for eight years and Julia 1.0 is imminent – we are not considering basic syntax changes at this point.

The argument that this is a dangerous feature seems pretty overstated. Expecting that passing nothing has a distinct meaning from not passing anything actually strikes me as the more dangerous behavior. It should, however, certainly be documented as a difference from R.

It sounds like an exception has been made for tuples – maybe array indexing can be another exception?

The exception in that case exists because parenthesizing expressions has a fairly well-established meaning (especially in mathematical expressions), which is different from constructing a 1-tuple. If there were more ASCII bracket pairs, we could use a different one for constructing tuples, but alas, there are only three and so parens ends up somewhat overloaded.

2 Likes