I don't know what the fuss is about.  This isn't about breaking the text model.
It's about a convenient way to turn text into bytes using a default, lenient, 
way.  Not the other way round.
Here's my proposal

b'foo%sbar' % (a)

would implicitly apply the following function equivalent to every object in the 
tuple:
def coerce_ascii(o):
    if has_bytes_interface(o):  return o
    return o.encode('ascii', 'strict')

There's no need for special %d or %f formatting.  If more fanciful formatting 
is required, e.g. exponents or, or precision, then by all means, to it in the 
str domain:

b'foo%sbar' %("%.15f"%(42.2, ))

Basically, let's just support simple bytes interpolation that will support 
coercing into bytes by means of strict ascii.
It's a one way convenience, explicitly requested, and for conselting adults.


-----Original Message-----
From: Python-Dev [mailto:python-dev-bounces+kristjan=ccpgames....@python.org] 
On Behalf Of Nick Coghlan
Sent: 11. janúar 2014 08:43
To: Ethan Furman
Cc: python-dev@python.org
Subject: Re: [Python-Dev] RFC: PEP 460: Add bytes % args and bytes.format(args) 
to Python 3.5

No, it's "the POSIX text model is completely broken and we're not letting 
people bring it back by stealth because they want to stuff their esoteric use 
case back into the builtin data types instead of writing their own dedicated 
type now that the builtin types don't handle it any more".


_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to