Something Like os.environ['HTTP_REFERER']

MRAB python at mrabarnett.plus.com
Sun Dec 20 12:26:36 EST 2009


Victor Subervi wrote:
> Hi; I'm looking for something like os.environ['HTTP_REFERER'] but for
> python scripts. That is, if I have a script that is imported by
> another script, how can I have the script that is being imported
> determine which script imported it?
> 
I don't know whether that's possible (it probably is), but I do know
that it's undesirable. A script shouldn't sometimes behave one way and
sometimes another. Explicit is better than implicit. If you want to
control its behaviour then you should do so explicitly.



More information about the Python-list mailing list