This was an amazing article that forced me to dive deep into the rabbit hole of Python documentation and read all the documentation. I think avoiding for loops explicitly can be an amazing mantra to discover a lot of "pythonic" ways to do things that someone is used to doing in other languages.
Just wanted to suggest a correction in the article.
> img[:-1:3], img[1::3] = img[1::3], img[:-1:3]
This creates sequences of ['g', 'r', 'b', 'g', 'r', 'b', ...]
This was an amazing article that forced me to dive deep into the rabbit hole of Python documentation and read all the documentation. I think avoiding for loops explicitly can be an amazing mantra to discover a lot of "pythonic" ways to do things that someone is used to doing in other languages.
Just wanted to suggest a correction in the article.
> img[:-1:3], img[1::3] = img[1::3], img[:-1:3]
This creates sequences of ['g', 'r', 'b', 'g', 'r', 'b', ...]
I think the correct code would be
img[:-1:3], img[2::3] = img[2::3], img[:-1:3]
['b', 'g', 'r', 'b', 'g', 'r', ....]
Nice catch :)