Replace format() with f-strings #8382

Closed
opened 2025-12-29 20:36:01 +01:00 by adam · 2 comments
Owner

Originally created by @DanSheps on GitHub (Jul 28, 2023).

Proposed Changes

Replacing any instance of format() with f-strings.

Justification

As per @jsenecal in #13296 f-strings offer some minor optimizations for performance and code readability.

We should replace format() where possible

Originally created by @DanSheps on GitHub (Jul 28, 2023). ### Proposed Changes Replacing any instance of format() with f-strings. ### Justification As per @jsenecal in [#13296](https://github.com/netbox-community/netbox/pull/13296#discussion_r1277904558_) f-strings offer some minor optimizations for performance and code readability. We should replace format() where possible
adam added the type: housekeeping label 2025-12-29 20:36:01 +01:00
adam closed this issue 2025-12-29 20:36:01 +01:00
Author
Owner

@jeremystretch commented on GitHub (Jul 30, 2023):

As I explained on Friday, the use of format() in many places is required to support translation, which is currently an ongoing initiative for v4.0. Please do not start making blanket changes to format strings until that work has been completed.

In the meantime, I'll point out that there are currently 41 open bug reports looking for owners.

@jeremystretch commented on GitHub (Jul 30, 2023): As I explained on Friday, the use of `format()` in many places is required to support translation, which is currently an ongoing initiative for v4.0. Please do not start making blanket changes to format strings until that work has been completed. In the meantime, I'll point out that there are currently [41 open bug reports](https://github.com/netbox-community/netbox/issues?q=is%3Aissue+is%3Aopen+no%3Aassignee+label%3A%22type%3A+bug%22) looking for owners.
Author
Owner

@jeremystretch commented on GitHub (May 22, 2024):

We can continue to replace calls to format() opportunistically where appropriate, but I don't think we'll ever be in a place to justify the effort of a concerted audit for this.

@jeremystretch commented on GitHub (May 22, 2024): We can continue to replace calls to `format()` opportunistically where appropriate, but I don't think we'll ever be in a place to justify the effort of a concerted audit for this.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#8382