On Tue, 21 Jul 2020 01:28:31 -0700 (PDT)
Carlton Gibson <carlton.gib...@gmail.com> wrote:
> 
> Certainly 99% of cases can be handled as cleanly (or more so, because
> I guess we fell `format()` is a little verbose) with %-formatting or
> an f-string. 
> But if we say format() is not allowed, don't we then guarantee we hit
> the one case in X where "Actually, this version with format() is much
> cleaner"? 
> 
FWIW, it seems to me one case where this happens is when you want to
use one argument multiple times, without naming:

        '<{0} id="{1}"> {2} </{0}>'.format(tag, id, content)

Arguably, this specific example would look better with named references,
but, IMO, not with % formatting:

        '<%(tag)s id="%(id)s"> %(content)s </%(tag)s>' % dict(
                tag=tag,        id=id, content=content
        )

and as noted, f-strings have their limitations.

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/20200721140822.47376bd8.shai%40platonix.com.

Reply via email to