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?
TIA,
Victor
--
http://mail.python.org/mailman/listinfo/python
On Sun, Dec 20, 2009 at 2:06 AM, Victor Subervi victorsube...@gmail.com 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
On Sun, Dec 20, 2009 at 5:18 AM, Chris Rebert c...@rebertia.com wrote:
On Sun, Dec 20, 2009 at 2:06 AM, Victor Subervi victorsube...@gmail.com
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
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
On Sun, Dec 20, 2009 at 3:05 AM, Victor Subervi victorsube...@gmail.comwrote:
Of course, I can pass the page name as a parameter, but that's not elegant.
That is precisely what it is in fact-- elegant; it is non-elegant to have
magical behavior where what 'imports' something somehow changes or
On Sun, Dec 20, 2009 at 1:20 PM, Stephen Hansen apt.shan...@gmail.comwrote:
On Sun, Dec 20, 2009 at 3:05 AM, Victor Subervi
victorsube...@gmail.comwrote:
Of course, I can pass the page name as a parameter, but that's not
elegant.
That is precisely what it is in fact-- elegant; it is
On Sun, Dec 20, 2009 at 11:01 AM, Victor Subervi victorsube...@gmail.comwrote:
If you want a piece of code to have a variable number of differing
behaviors, that's something you can handle in many elegant ways. That's
something inheritance is good for, with a core default behavior represented
Victor Subervi wrote:
On Sun, Dec 20, 2009 at 1:20 PM, Stephen Hansen apt.shan...@gmail.comwrote:
Of course, I can pass the page name as a parameter, but that's not
elegant.
That is precisely what it is in fact-- elegant; it is non-elegant to have
magical behavior where what 'imports'
On Sun, Dec 20, 2009 at 3:26 PM, Stephen Hansen apt.shan...@gmail.comwrote:
On Sun, Dec 20, 2009 at 11:01 AM, Victor Subervi
victorsube...@gmail.comwrote:
If you want a piece of code to have a variable number of differing
behaviors, that's something you can handle in many elegant ways.
Victor Subervi wrote:
Inelegant. This will be elegant:
ourFile = string.split(__file__, /)
p = ourFile[len(ourFile) - 1]
p = p[: - 3]
site = ourFile[4][:-10]
if site != '':
site = site[:-1]
from this import that(site)
Now it's automated.
V
Amazing. When trying to split a path string,
10 matches
Mail list logo