[issue14694] Option to show leading zeros for bin/hex/oct

2012-05-01 Thread Eric V. Smith
Eric V. Smith added the comment: I agree with Mark. This can also be done slightly more efficiently with plain format(): >>> format(324, "016b") '000101000100' >>> format(324, "016o") '0504' >>> format(324, "016x") '0144' And with either format() or str.format(), y

[issue14694] Option to show leading zeros for bin/hex/oct

2012-05-01 Thread Mark Dickinson
Mark Dickinson added the comment: I'm rejecting this: the functionality is already there in str.format, and there's little to be gained by adding another way to do it. -- nosy: +eric.smith resolution: -> rejected status: open -> closed ___ Python t

[issue14694] Option to show leading zeros for bin/hex/oct

2012-04-29 Thread Mark Dickinson
Changes by Mark Dickinson : -- stage: -> needs patch ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://ma

[issue14694] Option to show leading zeros for bin/hex/oct

2012-04-29 Thread Mark Dickinson
Changes by Mark Dickinson : -- versions: +Python 3.3 -Python 2.7 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue14694] Option to show leading zeros for bin/hex/oct

2012-04-29 Thread Mark Dickinson
Mark Dickinson added the comment: -1. str.format already does this quite effectively; I don't see a real need to complicate the bin, hex and oct signatures. >>> '{:016b}'.format(324) '000101000100' >>> '{:016o}'.format(324) '0504' >>> '{:016x}'.format(324) '0144'

[issue14694] Option to show leading zeros for bin/hex/oct

2012-04-29 Thread endolith
New submission from endolith : Suggestion: Add an option to bin/hex/oct functions to format binary output with a minimum fixed width, including leading zeros. Also might be useful for hex and oct. Currently, bin(18) produces '0b10010' with this change, something like bin(18, foo=8) would pro