This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author lorenz_
Recipients lorenz_, mark.dickinson, martin.panter, serhiy.storchaka, socketpair
Date 2021-10-05.05:05:44
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1633410344.97.0.0405261649761.issue27637@roundup.psfhosted.org>
In-reply-to
Content
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.
History
Date User Action Args
2021-10-05 05:05:45lorenz_setrecipients: + lorenz_, mark.dickinson, socketpair, martin.panter, serhiy.storchaka
2021-10-05 05:05:44lorenz_setmessageid: <1633410344.97.0.0405261649761.issue27637@roundup.psfhosted.org>
2021-10-05 05:05:44lorenz_linkissue27637 messages
2021-10-05 05:05:44lorenz_create