Issue 18222: os.path.abspath should accept multiple path parts and join them (original) (raw)

Issue18222

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:46 admin set github: 62422
2013-07-05 07:33:19 ezio.melotti set stage: resolved
2013-06-21 20:26:09 terry.reedy set status: open -> closednosy: + terry.reedymessages: + resolution: rejected
2013-06-15 14:00:28 lukasz.langa set nosy: + lukasz.langamessages: + versions: - Python 3.5
2013-06-15 13:49:24 r.david.murray set nosy: + r.david.murraymessages: +
2013-06-15 12:40:14 Łukasz.Balcerzak create