[Python-ideas] os.path.split(path, maxsplit=1)
ned at nedbatchelder.com
Mon Nov 5 13:52:44 CET 2012
Anatoly, I appreciate the energy and dedication you've shown to the
Python community, but maybe you should spend a little more time on each
proposal? For example, the subject line here is a different (and
already taken) function name than the implementation, and has a maxsplit
argument that the implementation doesn't have.
Get everything the way you want it, and then propose it.
On 11/5/2012 7:41 AM, anatoly techtonik wrote:
> It appears that implementation fails on 'foo/bar/'
> anatoly t.
> On Mon, Nov 5, 2012 at 2:08 PM, anatoly techtonik <techtonik at gmail.com> wrote:
>> pathsplit('asd/asd\\asd\sad') == '['asd', 'asd', 'asd', 'sad']
>> def pathsplit(pathstr):
>> """split relative path into list"""
>> path = list(os.path.split(pathstr))
>> while '' not in path[:2]:
>> path[:1] = list(os.path.split(path))
>> if path == '':
>> return path[1:]
>> return path[:1] + path[2:]
>> anatoly t.
>> On Mon, Nov 5, 2012 at 9:48 AM, anatoly techtonik <techtonik at gmail.com> wrote:
>>> Because it is critical when comparing paths and non-trivial.
>>> anatoly t.
> Python-ideas mailing list
> Python-ideas at python.org
More information about the Python-ideas