Message297960
The ``os`` functions generally accept any buffer-supporting object as file names, and interpret it as if ``bytes()`` had been called on it. However, ``os.listdir(x)`` uses the type of ``x`` to know if it should return a list of bytes or a list of unicodes---and the condition seems to be ``isinstance(x, bytes)``. So we get this kind of inconsistent behaviour:
>>> os.listdir(b".")
[b'python', b'Include', b'python-config.py', ...]
>>> os.listdir(bytearray(b"."))
['python', 'Include', 'python-config.py', ...] |
|
Date |
User |
Action |
Args |
2017-07-08 16:27:45 | arigo | set | recipients:
+ arigo |
2017-07-08 16:27:45 | arigo | set | messageid: <1499531265.54.0.318966689253.issue30879@psf.upfronthosting.co.za> |
2017-07-08 16:27:45 | arigo | link | issue30879 messages |
2017-07-08 16:27:45 | arigo | create | |
|