[Django] #31555: Use .fortmat() and f-strings in the polls tutorial

10 views
Skip to first unread message

Django

unread,
May 10, 2020, 1:41:26 AM5/10/20
to django-...@googlegroups.com
#31555: Use .fortmat() and f-strings in the polls tutorial
------------------------------------------------+------------------------
Reporter: yahya-abou-imran | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Documentation | Version: 3.0
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
------------------------------------------------+------------------------
Some part of the tutorial contains the old format way (with the %
operator)

{{{
return HttpResponse("You're looking at question %s." % question_id)
response = "You're looking at the results of question %s."
return HttpResponse(response % question_id)
}}}

I think it’s better to guide newcomers to the new way.
I’m ready to submit a patch for this if there’s nothing against it.

--
Ticket URL: <https://code.djangoproject.com/ticket/31555>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
May 10, 2020, 12:49:31 PM5/10/20
to django-...@googlegroups.com
#31555: Use .format() and f-strings in the polls tutorial
-------------------------------------+-------------------------------------
Reporter: Alexandre Poitevin | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: Documentation | Version: 3.0
Severity: Normal | Resolution:

Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

--
Ticket URL: <https://code.djangoproject.com/ticket/31555#comment:1>

Django

unread,
May 10, 2020, 12:55:17 PM5/10/20
to django-...@googlegroups.com
#31555: Use .format() and f-strings in the polls tutorial.

-------------------------------------+-------------------------------------
Reporter: Alexandre Poitevin | Owner: nobody
Type: | Status: closed
Cleanup/optimization |
Component: Documentation | Version: 3.0
Severity: Normal | Resolution: duplicate

Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by felixxm):

* status: new => closed
* resolution: => duplicate


Comment:

There is nothing wrong in `%` format. I don't see any reason to prefer
`.format()`, see [https://groups.google.com/forum/#!topic/django-
developers/psUTrFUNlQE/discussion discussion]. We could consider using
f-strings, but that's a duplicate of a more general ticket, see #29988.

--
Ticket URL: <https://code.djangoproject.com/ticket/31555#comment:2>

Reply all
Reply to author
Forward
0 new messages