Lorenz Panny <lor...@yx7.cc> added the comment:

I would like to express my support for making length=None to automatically use 
the minimal possible length. It's true that this will rarely be needed in 
production-grade serialization code, but this functionality is worth its weight 
in gold for quickly written proof-of-concept code or when using Python as a 
"pocket calculator" in an interactive shell.

I'm sure I've personally typed the expression (n.bit_length()+7)//8 
approximately a million times while quickly trying something. It'd be nice if 
Python could just do this simple computation for me instead. The code changes 
required are minimal and there shouldn't be any performance impact.

In fact, in my opinion this should even be the default behaviour, but 3.11 just 
made length=1 the default (see #45155) and changing this now would cause an 
(albeit very mild) API incompatibility.

----------
nosy: +lorenz_

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue27637>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to