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 2013-07-05 07:33 by ezio.melotti. 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
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