[Tutor] Understanding what the code does behind the scenes
alan.gauld at btinternet.com
Fri Oct 16 15:07:20 CEST 2009
"Dave Angel" <davea at ieee.org> wrote
> for text, color in color_items: #3
> textcolor(color) #4
> print text #5
Ah! Good call, I never thought of unpacking the tuple in the loop.
> It would be possible (and maybe even desirable) to write a different
> function to just take a single string, and parse it for some escape
> sequence to cause the color changes. But that's not what this one does.
I considered doing that but figured the OP would get even
more confused if I tried that! :-)
More information about the Tutor