Grant Edwards <invalid@invalid.invalid> writes: > On 2015-09-10, Steven D'Aprano <st...@pearwood.info> wrote: > >> I have a function which is intended for use at the interactive interpreter, >> but may sometimes be used non-interactively. I wish to change it's output >> depending on the context of how it is being called. > > [...] > > Sounds like an excellent way to waste somebody's afternoon when they > start to troubleshoot code that's using your function. Over and over > and over we tell newbies who have questions about what something > returns or how it works > > "Start up an interactive session, and try it!". > > If word gets out about functions like yours, we sort of end up looking > like twits. > >> If I did this thing, would people follow me down the street booing >> and jeering and throwing things at me? > > Only the people who use your function. :)
There are cases when it might be justified to alter the behavior e.g., *colorama* allows to strip ANSI codes (e.g., disable colored output) if stdout is not a tty or *win-unicode-console* make sys.stdout to use WriteConsoleW() to write Unicode to Windows console (interactive case). -- https://mail.python.org/mailman/listinfo/python-list