detect interactivity

Antoine Pitrou solipsis at pitrou.net
Wed Dec 30 03:01:36 EST 2009


Le Wed, 30 Dec 2009 03:33:18 +0100, Roald de Vries a écrit :
> 
> I'm using a database, and want to use python interactively to manipulate
> it. On the other hand, I also want to be able to use it non-
> interactively. In that case, it would be a waste of CPU to load the
> function/class definitions meant for interactive use.

Why don't you write a separate writer script for the interactive 
behaviour? This would be much simpler than trying to guess whether the 
current Python process is "interactive", since the latter is ill-defined.

Remember, explicit is better than implicit.




More information about the Python-list mailing list