On 5 July 2014 07:07, Ethan Furman <ethan@stoneleaf.us> wrote:
On 07/04/2014 01:39 PM, Nathaniel Smith wrote:

On Fri, Jul 4, 2014 at 9:10 PM, Tim Delaney wrote:

Your hack (aside from being pointlessly ugly) would actually prevent
pandas from using this feature. In pandas, slices like foo["a":"b"]
already have a meaning (i.e., take all items from the one labeled "a"
to the one labeled "b").

Isn't that the standard way slices are supposed to be used though?  Instead of integers Panda is allowing strings.  How would Pandas use the new feature?

I think Nathaniel is saying that pandas is already using string slices in an appropriate way (rather than abusing them), and so if this was just syntax sugar they wouldn't be able to use the new syntax for new functionality (since you couldn't distinguish the two).

It would be possible to make both approaches "work" by having an object that had all of .start, .stop, .step, .key and .value (and trying .key/.value first), but IMO that's going too far - I'd rather have a separate object with just .key and .value to test for.

Tim Delaney