Opened 3 years ago

Closed 3 years ago

#26250 closed Cleanup/optimization (wontfix)

Use a single string placeholder syntax for all user facing APIs

Reported by: Jon Dufresne Owned by: nobody
Component: Core (Other) Version: master
Severity: Normal Keywords:
Cc: Triage Stage: Someday/Maybe
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


Some Django APIs use the legacy % style placeholder syntax while others use the str.format() style syntax.

I think Django should pick one style and use it consistently for all user facing APIs.

For example:

str.format() syntax

Legacy % syntax

As success_url recently moved to str.format(), I'm guessing this is Django's preferred style?

I'm suggesting Django deprecate its use of the legacy % syntax in favor of str.format() syntax. I think this would create a greater API consistency throughout the framework.

django-developers discussion

Change History (2)

comment:1 Changed 3 years ago by Tim Graham

Component: UncategorizedCore (Other)
Triage Stage: UnreviewedSomeday/Maybe

Pending outcome of mailing discussion.

comment:2 Changed 3 years ago by Claude Paroz

Resolution: wontfix
Status: newclosed

In my opinion, the discussion didn't reveal any strong argument in favor of this move.

Summarizing James Bennett's post:

use format() in future commits if it's cleaner, or just adopt a policy of "if you're in there making a change and it won't break back compat, feel free to update to format() while you're at it".

Note: See TracTickets for help on using tickets.
Back to Top