[Python-ideas] Fixing the Python 3 bytes constructor

Neil Schemenauer nas-python at arctrix.com
Fri Mar 28 16:21:15 CET 2014


On 2014-03-28, Steven D'Aprano wrote:
> On Fri, Mar 28, 2014 at 08:27:33PM +1000, Nick Coghlan wrote:
> +1 on bytearray.allnull, with a mild preference for spelling it "zeroes" 
> instead.

I think numpy uses 'zeros' so we should use that.

> > Anyway, what do people think? Does anyone actually *like* the way the
> > bytes constructor in Python 3 currently handles integers and want to
> > keep it forever? 
> 
> Not me!

It's odd, IMHO.  When looking to implement %-interpolation for bytes
I did some searching to see how widely it is used.  There are a few
uses in the standard library but it really should have been a
special constructor.   Accidental uses probably outnumber
legitimate ones, quite a bad API design.

  Neil


More information about the Python-ideas mailing list