> Easily detecting interactive mode is of general interest for
> customization.
Thanks for the feedback. We could open a feature request for that, and/or ask python-ideas.
> What if C also set sys.flags.interactive in "python" mode, or exposed
> sys.flags.implicit_interactive (but with better name)?
An attribute in the sys module sounds like a good idea. It would not be an attribute of sys.flags though, as those are strictly command-line arguments.
> It's more useful to have a hook called when entering interactive mode, rather than a flag
> that's set from the beginning:
We already have such a hook: $PYTHONSTARTUP
> calling e.g. sys.__interactivehook__ sounds even better.
That’s another interesting idea.
> BTW, drawback of doing any such setup in site.py: "python -S" would be unfriendly!
People using -S don’t want the customizations done in site, so I don’t think there’s a problem here.