Bugs item #1560179, was opened at 2006-09-17 14:55
Message generated for change (Settings changed) made by gbrandl
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1560179&group_id=5470
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
>Status: Open
Resolution: None
Priority: 5
Submitted By: Michael Gebetsroither (einsteinmg)
Assigned to: Nobody/Anonymous (nobody)
Summary: Better/faster implementation of os.path.basename/dirname
Initial Comment:
hi,
basename/dirname could do better (especially on long
pathnames)
def basename(p):
return split(p)[1]
def dirname(p):
return split(p)[0]
both construct base and dirname and discard the unused
one.
what about that?
def basename(p):
i = p.rfind('/') + 1
return p[i:]
def dirname(p):
i = p.rfind('/') + 1
return p[:i]
greets,
michael
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1560179&group_id=5470
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com