2 ms·
"stressed" [8..1] desserts Beautiful. Far more so than Python’s "stressed"[::-1] (which I also think is very neat.) Oddly given the comments on Pascal it
by vintagedave 2mo ago
"stressed" [8..1]
desserts
Beautiful. Far more so than Python’s "stressed"[::-1] (which I also think is very neat.)
Oddly given the comments on Pascal it reminds me most of Pascal’s range syntax. I love its ranges and sets.
- Someone 2mo ago> Beautiful. Far more so than Python’s "stressed"[::-1]" “stressed" [8..1]” Looks better, but IMO is worse, as it requires you to know the length of the string. Change the string and forget to update the indexing expression and you’ve got a (possibly silent) bug. Having said that, Python IMO may be too powerful here, allowing, for example "abcdefghijklmnopqrstuvwxyz”[-5:10:-3] 'vspm' Makes perfect sense (from the fifth character from the end, step back 3 characters at a time until you reach the 10th character), but may be too cryptic for some.