[Python-Dev] PEP 467: Minor API improvements for bytes & bytearray
ncoghlan at gmail.com
Mon Aug 18 01:51:40 CEST 2014
On 18 Aug 2014 09:41, "Raymond Hettinger" <raymond.hettinger at gmail.com>
> I encourage restraint against adding an unneeded class method that has no
> elsewhere. Right now, the learning curve is mitigated because bytes is
> and because bytearray is list-like (i.e. the method names have been used
> and likely already learned before encountering bytes() or bytearray()).
Putting in new,
> rarely used funky method adds to the learning burden.
> If you do press forward with adding it (and I don't see why), then as an
> constructor, the name should be from_int() or some such to avoid ambiguity
> and to make clear that it is a class method.
If I remember the sequence of events correctly, I thought of
map(bytes.byte, data) first, and then Guido suggested a dedicated
iterbytes() method later.
The step I hadn't taken (until now) was realising that the new
memoryview(data).iterbytes() capability actually combines with the existing
(bytes([b]) for b in data) to make the original bytes.byte idea unnecessary.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-Dev