Message18643
Logged In: YES
user_id=887415
Hi Jeremy
The purpose of path.expandvars is to retrieve environment
variables in a platform independant way into a user supplied
string, as in path.expandvars('$PYTHON/Lib/site-packages').
Using %vars% on windows and $vars on unix would make the
method pointless. So this is no bug, though it might be
explained a little vague in the docstring (IMHO the overall
purpose and the phrase "left unchanged" are both unclear):
>>> help(path.expandvars)
Help on function expandvars in module ntpath:
expandvars(path)
Expand shell variables of form $var and ${var}.
Unknown variables are left unchanged.
Though, the module docs offer a better explanation:
"Return the argument with environment variables expanded.
Substrings of the form "$name" or "${name}" are replaced by
the value of environment variable name. Malformed variable
names and references to non-existing variables are left
unchanged. On the Macintosh, this always returns path
unchanged."
Still, what does "unchanged" mean? On my windows system
non-existing variables are IGNORED, they are not left
unchanged anywhere:
>>> path.expandvars('$MADEUP/Lib/site-packages')
'/Lib/site-packages'
Is it me or is that a bug? :)
...johahn
|
|
Date |
User |
Action |
Args |
2007-08-23 14:17:42 | admin | link | issue824371 messages |
2007-08-23 14:17:42 | admin | create | |
|