$p[...] - Elided Lists For When Things Get Large |
Top Previous Next |
Parameters can easily be created that contain hundreds or thousands of possibilities.
$p=range(1,1000)
In this example, $p could be any number from 1 to 1000. If we output the full list of possibilities using $p[1,$p[0]] or $p[], the resulting string will be huge.
As an alternative, you can output an elided version of the full list.
$p[...]
This will automatically remove the middle of the list, replacing it with an ellipsis.
1, 2, 3, 4, 5, 6, 7, 8 ... 996, 997, 998, 999, 1000
You can also specify a new separator for an elided list. For example
$p[...,+]
will replace the , with a +
1+2+3+4+5+6+7+8+ ... +996+997+998+999+1000
|