Movatterモバイル変換


[0]ホーム

URL:


homepage

Issue19777

This issue trackerhas been migrated toGitHub, and is currentlyread-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title:Provide a home() classmethod on Path objects
Type:enhancementStage:resolved
Components:Library (Lib)Versions:Python 3.5
process
Status:closedResolution:fixed
Dependencies:Superseder:
Assigned To:Nosy List: Arfrever, artifex93, martin.panter, neologix, oquanox, pitrou, python-dev, serhiy.storchaka, vstinner
Priority:lowKeywords:easy, patch

Created on2013-11-25 20:04 bypitrou, last changed2022-04-11 14:57 byadmin. This issue is nowclosed.

Files
File nameUploadedDescriptionEdit
path_home.patchmcsalgado,2015-01-01 17:20review
path_home2.patchmcsalgado,2015-01-01 18:43review
home.patchoquanox,2015-01-04 08:58review
Messages (8)
msg204388 -(view)Author: Antoine Pitrou (pitrou)*(Python committer)Date: 2013-11-25 20:04
Similar to Path.cwd(), perhaps a Path.home() to create a new Path object pointing to the current user's home directory may be useful.
msg204459 -(view)Author: Charles-François Natali (neologix)*(Python committer)Date: 2013-11-26 07:56
IMO, this functionality is subsumed byhttp://bugs.python.org/issue19776(Path.expanduser).
msg225246 -(view)Author: Antoine Pitrou (pitrou)*(Python committer)Date: 2014-08-12 23:41
> IMO, this functionality is subsumed byhttp://bugs.python.org/issue19776Roughly, yes, but it can also be a useful convenience (expanduser('~') isn't that user-friendly, especially for Windows users).
msg233403 -(view)Author: Mayank Tripathi (oquanox)*Date: 2015-01-04 08:58
Added docs to mcsalgado's patch.
msg233528 -(view)Author: STINNER Victor (vstinner)*(Python committer)Date: 2015-01-06 11:46
I agree that Path.home() is more user friendly than Path.expanduser('~').
msg233887 -(view)Author: STINNER Victor (vstinner)*(Python committer)Date: 2015-01-12 20:55
+    def _test_home(self, p):+        q = self.cls(os.path.expanduser('~'))+        self.assertEqual(p, q)+        self.assertEqual(str(p), str(q))+        self.assertIs(type(p), type(q))+        self.assertTrue(p.is_absolute())++    def test_home(self):+        p = self.cls.home()+        self._test_home(p)Why are you using a submethod _test_home()?
msg233888 -(view)Author: Roundup Robot (python-dev)(Python triager)Date: 2015-01-12 21:24
New changeset4a55b98314cd by Antoine Pitrou in branch 'default':Issue#19777: Provide a home() classmethod on Path objects.https://hg.python.org/cpython/rev/4a55b98314cd
msg233898 -(view)Author: Antoine Pitrou (pitrou)*(Python committer)Date: 2015-01-13 00:48
I've committed the patch, thank you!
History
DateUserActionArgs
2022-04-11 14:57:54adminsetgithub: 63976
2015-01-13 00:48:28pitrousetstatus: open -> closed
resolution: fixed
messages: +msg233898

stage: needs patch -> resolved
2015-01-12 21:24:23python-devsetnosy: +python-dev
messages: +msg233888
2015-01-12 20:55:06vstinnersetmessages: +msg233887
2015-01-06 11:46:26vstinnersetnosy: +vstinner
messages: +msg233528
2015-01-04 08:58:33oquanoxsetfiles: +home.patch
nosy: +oquanox
messages: +msg233403

2015-01-01 18:43:19mcsalgadosetfiles: +path_home2.patch
2015-01-01 17:28:23artifex93setnosy: +artifex93
2015-01-01 17:20:10mcsalgadosetfiles: +path_home.patch
keywords: +patch
2015-01-01 12:09:58pitrousetkeywords: +easy
stage: needs patch
2014-11-14 00:32:20martin.pantersetnosy: +martin.panter
2014-08-12 23:41:32pitrousetnosy: +serhiy.storchaka
messages: +msg225246
2013-11-26 07:56:24neologixsetnosy: +neologix
messages: +msg204459
2013-11-26 02:29:49Arfreversetnosy: +Arfrever
2013-11-25 20:04:23pitroucreate
Supported byThe Python Software Foundation,
Powered byRoundup
Copyright © 1990-2022,Python Software Foundation
Legal Statements

[8]ページ先頭

©2009-2026 Movatter.jp