Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.7k
Closed
Description
Feature or enhancement
Proposal:
Currently both implemenatations ofrelpath() are a bit inefficient. So they could use some optimisations:
- We don't need to apply
normpath()beforeabspath(), it already normalises it:-start_abs = abspath(normpath(start))-path_abs = abspath(normpath(path))+start_abs = abspath(start)+path_abs = abspath(path)
- We don't need to filter the segments, we just need to check if
*_restis empty:-start_list = [x for x in start_rest.split(sep) if x]-path_list = [x for x in path_rest.split(sep) if x]+start_list = start_rest.split(sep) if start_rest else []+path_list = path_rest.split(sep) if path_rest else []
- We can use
str.join()instead ofos.path.join():-return join(*rel_list)+return sep.join(rel_list)
Has this already been discussed elsewhere?
This is a minor feature, which does not need previous discussion elsewhere
Links to previous discussion of this feature:
No response