[tchrist]
>> GOTCHA: (medium)
>> Slices in Python must be contiguous ranges of a sequence.
>> In Perl, there's no such restriction.
[Michael Hudson]
> At some point Python will probably support `extended slice syntax'
> like so:
>
> range(0,10)[1:4:2] => [1,3]
>
> Numerical Python already does this.
[tchrist]
>> GOTCHA: (medium)
>> You can't slice dictionaries at all in Python. In Perl, it's
>> easy to slice a hash, and just as sensible.
[Michael Hudson]
> Huh? What would that mean? There's no reason to suspect that the keys
> of a dictionary are ordered.
What Tom calls "slicing" here the NumPy folk would call gather/scatter
subscripting. A list can be used as an index, e.g.
thing[[7,2,3]] == [thing[7], thing[2], thing[3]]
Perl has something like that; Python does not.
can't-tell-the-subscripting-modes-without-a-scorecard-ly y'rs - tim
>> GOTCHA: (medium)
>> Slices in Python must be contiguous ranges of a sequence.
>> In Perl, there's no such restriction.
[Michael Hudson]
> At some point Python will probably support `extended slice syntax'
> like so:
>
> range(0,10)[1:4:2] => [1,3]
>
> Numerical Python already does this.
[tchrist]
>> GOTCHA: (medium)
>> You can't slice dictionaries at all in Python. In Perl, it's
>> easy to slice a hash, and just as sensible.
[Michael Hudson]
> Huh? What would that mean? There's no reason to suspect that the keys
> of a dictionary are ordered.
What Tom calls "slicing" here the NumPy folk would call gather/scatter
subscripting. A list can be used as an index, e.g.
thing[[7,2,3]] == [thing[7], thing[2], thing[3]]
Perl has something like that; Python does not.
can't-tell-the-subscripting-modes-without-a-scorecard-ly y'rs - tim