On Sun, Sep 26, 2010 at 9:02 AM, Greg Ewing email@example.com wrote:
Antoine Pitrou wrote:
So what? The behaviour of fetching the canonical name can be added to the behaviour of resolving symlinks.
Finding the actual name (I wouldn't call it "canonical", since that term could be ambiguous) requires reading the contents of entire directories at each step, which could be noticeably less efficient than what realpath() currently does. Users who only want symlinks expanded might object to that.
An option could be added to realpath(), but then we're into constant-parameter territory.
Constant parameter territory isn't *necessarily* a bad thing if the number of parameters is sufficiently high. In particular, if you have one basic command (say, "give me the canonical path for this possibly-non-canonical path I already have") with a gazillion different variants (*ahem*), then a single function with well-named boolean parameters (to explain "this is what I really mean by 'canonical path'") is likely to be much easier for people to remember than trying to create a concise-yet-meaningful mnemonic for each variant.
So we shouldn't dismiss out of hand the idea of a keyword-only "swiss-army" path normalisation function that can at least be queried via help() if you forget the exact spelling for the various parameters.