[issue3187] os.listdir can return byte strings

STINNER Victor report at bugs.python.org
Fri Oct 3 14:23:29 CEST 2008


STINNER Victor <victor.stinner at haypocalc.com> added the comment:

path=path is useless most of the code (unicode path), this code is 
faster if both cases (bytes or unicode)!
   if not isinstance(path, str):
      path = bytes(path)

* a if b else c: unicode=0.756730079651; bytes=1.93071103096
* if test: path=...: unicode=0.681571006775; bytes=1.88843798637

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue3187>
_______________________________________


More information about the Python-bugs-list mailing list