It would be nice if emerge would not output color escape sequences when redirected to a pipe or a file. Assuming that Python allows to check the type of the file descriptor, of course. It's unnerving to see the "junk" when piping the output to `less', for example. ;^)
I think 'less -r' (which should be the default in newer baselayouts) will do what you want. For other cases, if there is not already, we should probably provide an option to emerge that disables color (like keychain).
"less -r" does what you say, but my main point was that whenever the output goes to anything other than a terminal, the color escapes are, probably, not welcome. So, if there is a way to detect what sort of a file descriptor the stdout is, the output should not be coloured unless it is a tty.
Imho it's not possible to detect this automatically, therefor marking as duplicate of bug 414 *** This bug has been marked as a duplicate of 414 ***