[Python-ideas] Binary f-strings

Guido van Rossum guido at python.org
Sat Oct 3 05:44:23 CEST 2015


On Fri, Oct 2, 2015 at 8:33 PM, Chris Angelico <rosuav at gmail.com> wrote:

> On Sat, Oct 3, 2015 at 1:27 PM, Steven D'Aprano <steve at pearwood.info>
> wrote:
> > On Fri, Oct 02, 2015 at 09:00:56AM -0700, Guido van Rossum wrote:
> >> Bingo. IMO the exact same arguments that show why f'{x} {y}' is better
> than
> >> '%s %s' % (x, y) applies to byte strings. It would be totally
> acceptable if
> >> it only took bytes (and bytearray, and memoryview) and numbers (which we
> >> can guarantee are rendered in ASCII only).
> >
> > As Chris A pointed out earlier, identifiers are not ASCII only. What are
> > we to make of something like this?
> >
> >     bf'{αριθμός + 1}'
> >
> > And don't say "re-write your code to only use ASCII variable names" :-)
>
> It should be technically legal, btw; it's just going to look very odd.
> The check for ASCII-only has to be done _after_ the fracturing into
> strings and expressions. But I don't like how that reads.
>

I don't think this concern should be a showstopper. Honestly either
approach sounds fine to me. :-)

-- 
--Guido van Rossum (python.org/~guido)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20151002/cc087cd7/attachment.html>


More information about the Python-ideas mailing list