Pyrfecter logo Pyrfecter

Python linter, formatter, and modernizer to make your code positively perfect!

Input
first_name = "Daffy"
last_name = "Duck"
full_name = "{} {}".format(first_name, last_name)
Output

Linting & Analysis

🧑‍💻 Learning Python? Check out these great resources:

Cover image for Python Crash Course, 3rd Edition: A Hands-On, Project-Based Introduction to Programming by Eric MatthesCover image for Automate the Boring Stuff with Python, 3rd Edition, by Al SweigartCover image for Think Python: How to Think Like a Computer Scientist, 3rd Edition, by Allen Downey

Modernize your string formatting with f-strings

Introduced in PEP-498 and first released with Python 3.6, f-strings are "formatted string literals", or "formatted strings", with a syntax like f"{variable_name}":

>>> name = "Pat"
>>> f"Hello, {name}"
Hello, Pat

For anyone coming from a JavaScript or TypeScript background, f-strings are similar to template literals, also known as template strings.

In JavaScript, a template string looks like this:

>>> const name = 'Pat'
>>> console.log(`Hello, ${name}`)
Hello, Pat

Pyrfecter uses a library called flynt to convert older string formatting syntax to f-strings, and it converts both .format() and '%s' % ...-style string formatting.

How can Python f-strings improve your code?

In lots of ways. As Real Python says:

Not only are they more readable, more concise, and less prone to error than other ways of formatting, but they are also faster!

Plus, using flynt (inside or outside of Pyrfecter) means that your code will use a single method of formatting strings, which will make your code more consistent.

So, what are you waiting for? Pyrfect those strings!