homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: os.path.abspath should accept multiple path parts and join them
Type: enhancement Stage: resolved
Components: Library (Lib) Versions: Python 3.4
process
Status: closed Resolution: rejected
Dependencies: Superseder:
Assigned To: Nosy List: lukasz.langa, r.david.murray, terry.reedy, Łukasz.Balcerzak
Priority: normal Keywords: patch

Created on 2013年06月15日 12:40 by Łukasz.Balcerzak, last changed 2022年04月11日 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
abspath-with-joins.diff Łukasz.Balcerzak, 2013年06月15日 12:40 review
Messages (4)
msg191203 - (view) Author: Łukasz Balcerzak (Łukasz.Balcerzak) * Date: 2013年06月15日 12:40
In projects I work on I constantly end up creating something like:
 abspath = lambda *p: os.path.abspath(os.path.join(*p))
This could be easily avoided by allowing abspath to accept multiple arguments. This would be:
1. Backward compatibile (calls with single argument would remain the same)
2. Very simple to fix (just join given path parts before doing anything else)
I can document this, do most of the coding and test on Mac and linux, however would not be able to test on other platforms.
Let me know if this is acceptable. Attaching a diff with posixpath update.
msg191206 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2013年06月15日 13:49
I'm -1 on this. It doesn't make sense to me to conflate two functions like that. If you need that functionality often in your application, just write a small helper function.
msg191207 - (view) Author: Łukasz Langa (lukasz.langa) * (Python committer) Date: 2013年06月15日 14:00
Would you expect to make the following also accept a sequence of path elements?
- normpath, realpath, relpath
- dirname
- exists, lexists
- expanduser, expandvars
- isdir, isfile, islink
- getsize, etc.
I agree with R. David's sentiment. Moreover, relpath takes an optional second argument which would make this change backward incompatible.
msg191608 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2013年06月21日 20:26
Ditto, for reasons given
History
Date User Action Args
2022年04月11日 14:57:46adminsetgithub: 62422
2013年07月05日 07:33:19ezio.melottisetstage: resolved
2013年06月21日 20:26:09terry.reedysetstatus: open -> closed

nosy: + terry.reedy
messages: + msg191608

resolution: rejected
2013年06月15日 14:00:28lukasz.langasetnosy: + lukasz.langa

messages: + msg191207
versions: - Python 3.5
2013年06月15日 13:49:24r.david.murraysetnosy: + r.david.murray
messages: + msg191206
2013年06月15日 12:40:14Łukasz.Balcerzakcreate

AltStyle によって変換されたページ (->オリジナル) /