diff -r cc8953ea3c7e Lib/pathlib.py --- a/Lib/pathlib.py Sun Dec 01 10:03:26 2013 +0100 +++ b/Lib/pathlib.py Sun Dec 01 11:25:05 2013 +0200 @@ -948,6 +948,11 @@ """ return cls(os.getcwd()) + def expanduser(self): + """ Return a new path with expanded ~ and ~user constructs. + """ + return self.__class__(os.path.expanduser(str(self))) + def iterdir(self): """Iterate over the files in this directory. Does not yield any result for the special paths '.' and '..'. diff -r cc8953ea3c7e Lib/test/test_pathlib.py --- a/Lib/test/test_pathlib.py Sun Dec 01 10:03:26 2013 +0100 +++ b/Lib/test/test_pathlib.py Sun Dec 01 11:25:05 2013 +0200 @@ -1134,6 +1134,11 @@ p = self.cls('') self.assertEqual(p.stat(), os.stat('.')) + def test_expanduser(self): + p = self.cls('~') + self.assertEqual(os.path.expanduser(str(p)), + str(p.expanduser())) + def test_exists(self): P = self.cls p = P(BASE)