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 eric.smith
Recipients eric.smith, ncoghlan, vstinner
Date 2014-09-11.07:34:35
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1410420875.6.0.104328499043.issue22385@psf.upfronthosting.co.za>
In-reply-to
Content
I'm not particularly wild about the .precision syntax either, but I think the feature is generally useful.

Adding bytes.__format__ is exactly what "special output for bytes" _is_, as far as format() is concerned.

Another option would be to invent a new format specification for bytes. There's no reason it needs to follow the same syntax as for str, int, etc., except for ease of remembering the syntax, and some code reuse.

For example, although it's insane, you could do:

format(b'abcdwxyz', 'use_spaces,grouping=4,add_prefix')
  -> '0x61626364 0x7778797a'
History
Date User Action Args
2014-09-11 07:34:35eric.smithsetrecipients: + eric.smith, ncoghlan, vstinner
2014-09-11 07:34:35eric.smithsetmessageid: <1410420875.6.0.104328499043.issue22385@psf.upfronthosting.co.za>
2014-09-11 07:34:35eric.smithlinkissue22385 messages
2014-09-11 07:34:35eric.smithcreate