On Fri, Oct 05, 2012 at 02:38:57PM -0700, Ethan Furman
Antoine Pitrou wrote:
Extraneous path separators and ``"."`` components are eliminated::
PurePath('a///b/c/./d/') PurePosixPath('a/b/c/d')
I'm all for eliminating extra '.'s, but shouldn't extra '/'s be an error?
Why? They aren't errors in the underlying OS.
p = PureNTPath('c:/python33/bin/python.exe') for parent in p.parents(): parent ... PureNTPath('c:\\python33\\bin') PureNTPath('c:\\python33') PureNTPath('c:\\')
What's the use-case for iterating through all the parent directories?
for parent in p.parents(): if parent['.svn'].exists(): last_seen = parent continue else: print("The topmost directory of the project: %s" % last_seen) break Oleg. -- Oleg Broytman http://phdru.name/ phd@phdru.name Programmers don't die, they just GOSUB without RETURN.