[Python-Dev] PEP 467: Minor API improvements for bytes & bytearray
Victor Stinner
victor.stinner at gmail.com
Fri Aug 15 21:55:46 CEST 2014
2014-08-15 7:50 GMT+02:00 Nick Coghlan <ncoghlan at gmail.com>:
> As far as I am aware, that last item poses the only open question,
> with the alternative being to add an "iterbytes" builtin (...)
Do you have examples of use cases for a builtin function? I only found
5 usages of bytes((byte,)) constructor in the standard library:
$ grep -E 'bytes\(\([^)]+, *\)\)' $(find -name "*.py")
./Lib/quopri.py: c = bytes((c,))
./Lib/quopri.py: c = bytes((c,))
./Lib/base64.py: b32tab = [bytes((i,)) for i in _b32alphabet]
./Lib/base64.py: _a85chars = [bytes((i,)) for i in range(33, 118)]
./Lib/base64.py: _b85chars = [bytes((i,)) for i in _b85alphabet]
bytes.iterbytes() can be used in 4 cases on 5. Adding a new builtin
for a single line in the whole standard library doesn't look right.
Victor
More information about the Python-Dev
mailing list