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.

classification
Title: add format handler to bytes object
Type: enhancement Stage:
Components: Versions: Python 3.3
process
Status: closed Resolution: duplicate
Dependencies: Superseder:
Assigned To: Nosy List: eric.smith, nestor
Priority: normal Keywords:

Created on 2011-03-04 15:18 by nestor, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (4)
msg130055 - (view) Author: nestor (nestor) Date: 2011-03-04 15:18
Many programs written for Python 2.x use simple string interpolation to create byte strings with specific layout, this is gone in 3.x. Is it possible to support the format method but maybe only supporting field names like '{}' '{1}{2}' '{name}' and not conversion and formatting for the bytes type?

Examples:
http://mail.python.org/pipermail/python-list/2011-March/1267308.html

and the "get_current_url" function at this post:
http://lucumr.pocoo.org/2010/5/25/wsgi-on-python-3/
msg130056 - (view) Author: Eric V. Smith (eric.smith) * (Python committer) Date: 2011-03-04 15:35
There have been a number of discussions about this, but no concrete proposal. The last one I recall was to add a __bformat__ method, but I couldn't find the email trail just now.

See also issue 3982.
msg130057 - (view) Author: nestor (nestor) Date: 2011-03-04 16:15
My search fu has failed me this time. This is indeed a duplicate of issue 3982. I think the issue is real and not going to go away, but finding a beautiful solution has been elusive so far.
msg130058 - (view) Author: Eric V. Smith (eric.smith) * (Python committer) Date: 2011-03-04 16:20
I found part of the discussion I was looking for:
http://mail.python.org/pipermail/python-dev/2010-July/102252.html
History
Date User Action Args
2022-04-11 14:57:13adminsetgithub: 55605
2011-03-04 16:20:27eric.smithsetstatus: open -> closed
nosy: eric.smith, nestor
messages: + msg130058
2011-03-04 16:15:52nestorsetresolution: duplicate
messages: + msg130057
nosy: eric.smith, nestor
2011-03-04 15:35:05eric.smithsetnosy: + eric.smith
messages: + msg130056
2011-03-04 15:18:52nestorcreate