Yet Another Python Formatter (YAPF) is a valuable tool for writing Python. YAPF is an open-source Python Formatter that makes writing clean Python code a lot easier, so you can spend more time writing code and less time worrying about how it looks. One of the great advantages of using this formatter (besides the pretty code) is that it makes it super easy for Python code written by any number of developers to be integrated into one file or even one large directory or project.

As you'll see on their github page, YAPF will take your ugly code:


And reformat it into this nicely organized code:


YAPF isn't your average reformatter because it'll reformat your entire files, not just format your code line by line into a nice looking template. It actually re-organizes and re-structures your Python, not just to make it look better, but to help optimize performance. If you write a lot of Python, it's truly and indispensable tool to have at your disposal.

To Practice: Try this interactive course on the basics of Lists, Functions, Packages and NumPy in Python.