[Python-Dev] PEP 467: Minor API improvements for bytes & bytearray

Antoine Pitrou antoine at python.org
Mon Aug 18 00:33:01 CEST 2014


Le 17/08/2014 13:07, Raymond Hettinger a écrit :
>
> FWIW, I've been teaching Python full time for three years.  I cover the
> use of bytearray(n) in my classes and not a single person out of 3000+
> engineers have had a problem with it.

This is less about bytearray() than bytes(), IMO. bytearray() is 
sufficiently specialized that only experienced people will encounter it.

And while preallocating a bytearray of a certain size makes sense, it's 
completely pointless for a bytes object.

Regards

Antoine.




More information about the Python-Dev mailing list