[Python-Dev] PEP 370, open questions (original) (raw)
Tim Golden mail at timgolden.me.uk
Thu Jan 17 17:38:48 CET 2008
- Previous message: [Python-Dev] PEP 370, open questions
- Next message: [Python-Dev] PEP 370, open questions
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Paul Moore wrote:
The best we can hope for is to point to HOMEDRIVE/PATH as Paul suggested (possibly rewiring os.path.expanduser to try that first, depending on Win2K stuff) os.path.expanduser uses HOMEDRIVE/HOMEPATH. It checks for an explicit HOME (set manually by the user, this isn't a Windows standard name) first. (At least in 2.5, see ntpath.py)
Ummm... see my earlier point a few posts back which refers to r54364 which gave priority to USERPROFILE over HOMEDRIVE/HOMEPATH
I think consistency with os.path.expanduser('~') is a significant benefit.
Agreed entirely.
Given that os.path.expanduser allows HOME to override HOMEDRIVE/HOMEPATH, users in this position could set an explicit HOME.
You're right of course (and that's what I do now, in fact). It's just that it doesn't feel quite right relying on a nonstandard env var. It means if I log on to another machine and want to take advantage of these theoretically roaming Python modules I'd have to remember to set my HOME var to something.
The one downside of following expanduser is that Christian's code is in C, where ntpath.expanduser is in Python, so there are 2 versions to keep in sync. Maybe Christian could expose his C implementation, which ntpath.expanduser could then reuse?
If it had its priorities switched around, Christian's patch could simply call os.path.expanduser.
I'll hold off now. The situation's clear enough and I'm not really offering anything here. There hard part's going to be making a decision. I think my proposal amounts to:
- Switch the priority of env var checks in os.path.expanduser so that HOMEDRIVE/PATH comes before USERPROFILE.
- Have the new code use os.path.expanduser under Windows
- Document the fact that installing in a per-user way might be writing considerable amounts to a network-based profile.
TJG
- Previous message: [Python-Dev] PEP 370, open questions
- Next message: [Python-Dev] PEP 370, open questions
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]