On 18 Aug 2014 09:41, "Raymond Hettinger" <raymond.hettin...@gmail.com> wrote: > > > I encourage restraint against adding an unneeded class method that has no parallel > elsewhere. Right now, the learning curve is mitigated because bytes is very str-like > and because bytearray is list-like (i.e. the method names have been used elsewhere > 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 alternate > 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. Cheers, Nick.
_______________________________________________ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com