110869673414826847

Published: Fri 11 August 2023
Updated: Fri 11 August 2023
By me

In misc.

@mcc I don't know if this have been made clear from previous reply, but the python slice builtin function return a type with one specific goal, be stored in variable and reused in bracket notation. Like `s = slice(2, 20); range(100)[s]`. The bracket on most iterable will only accept integer and slice, no tuple for instance even if the notation looks like tuple.
In practice, you use range a lot and slice practically never.

links

social