[Python-Dev] PEP: per user site-packages directory

Jeroen Ruigrok van der Werven asmodai at in-nomine.org
Mon Jan 21 09:33:48 CET 2008


-On [20080120 19:34], Christian Heimes (lists at cheimes.de) wrote:
>Most Python developers should the meaning of "~". Should I replace ~
>with $HOME for those who don't have as much experience with Unix as we?

The problem is that ~ is an expansion character. It expands the contents of
$HOME. If HOME is set to /usr/local, using ~ will expand to /usr/local.

This behaviour is undefined by POSIX, if HOME is null/empty than expanding ~
is undefined. If it is just ~ then it will expand to the contents of HOME, if
~ is followed by a string then it will do a getpwnam() call on the string and
expand that to the initial working directory of said login name string.

HOME is POSIX-mandated to be '[t]he pathname of the user's home directory'.

-- 
Jeroen Ruigrok van der Werven <asmodai(-at-)in-nomine.org> / asmodai
イェルーン ラウフロック ヴァン デル ウェルヴェン
http://www.in-nomine.org/ | http://www.rangaku.org/
Hope is the last refuge for mad men and dreamers...


More information about the Python-Dev mailing list