question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Use f-strings instead of .format

See original GitHub issue

Python 3.6+ supports a new style of string formatting which reads much easier.

uri = urlparse("{}://{}".format(scheme, connect_url))

becomes

uri = urlparse(f'{scheme}://{connect_url}')

This reads nicer in areas like the protocol where we are concatting strings with + as well.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:9 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
charliestrawncommented, May 14, 2019

Yep no rush, totally a cosmetic update.

0reactions
charliestrawncommented, Apr 12, 2020

Yeah I’m pretty sure we are already using some things that bind us to 3.6 or later. Closing as addressed in #152

Read more comments on GitHub >

github_iconTop Results From Across the Web

Python 3's f-Strings: An Improved String Formatting Syntax ...
As of Python 3.6, f-strings are a great new way to format strings. Not only are they more readable, more concise, and less...
Read more >
f-strings vs str.format() - Stack Overflow
I'm using the .format() a lot in my Python 3.5 projects, but I'm afraid that it will be deprecated during the next Python...
Read more >
A Guide to Formatting with f-strings in Python - CIS Sandbox
To use formatted string literals, begin a string with f or F before the opening quotation mark or triple quotation mark in a...
Read more >
Python f-String Tutorial – String Formatting in ... - freeCodeCamp
But in Python 3.6 and later, you can use f-Strings instead. f-Strings, also called formatted string literals, have a more succinct syntax ...
Read more >
f-strings in Python - GeeksforGeeks
To create an f-string, prefix the string with the letter “ f ”. The string itself can be formatted in much the same...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found