Re: The '.' at the head of the default sys.path

Steven D. Majewski (sdm7g@elvis.med.virginia.edu)
Wed, 15 Jun 1994 11:39:27 -0400

On Jun 15, 8:35, Mike Tibbs wrote:
>
> I second Ken's proposal.
>
> There have been times when I needed to completely replace the sys.path
> and it would have been nice to do it via PYTHONPATH.
>
> -- End of excerpt from Mike Tibbs <tibbs@dopey.si.com>

I happen to usually want '.' at the head of my sys.path, but I don't
see that the default values make much difference one way or the other
since:
(1) It's is easy to change them to what you want at build time.
(2) By definition, it is a site-specific value, and no code SHOULD
be broken by any value.

However: although having PYTHONPATH's value prepended to the
builtin-value is a convenience, it's clear that there are times
when what you WANT is to override the defaults completely.
( especially for server scripts )

So I propose that:

PYTHONPATH=':/usr/local/python/lib:/usr/share/python/lib'

and

PYTHONPATH='/usr/local/python/lib:/usr/share/python/lib'

be give two different interpretations. One replaces the
value of sys.path and the other prepends it's value to
sys.path.

I'm not picky about which is which, and maybe someone
can suggest a better convention ( maybe it makes more
sense for the colon to go at the end for prepending ? )
but I agree the the current conventions don't make for
very secure scripts. However, most of my use is
interactive, which is why I like the current defaults
as long as there is a way to MAKE a secure script.
Right now, the only method is to use my 'ImportFrom'
hack to give an explicit pathname for import. ( Which,
come to think of it, is probably the best way to do
it anyway, but the above proposal would be a pretty
minimal change. )

- Steve Majewski (804-982-0831) <sdm7g@Virginia.EDU>
- UVA Department of Molecular Physiology and Biological Physics