paint-brush
10 Ways To Refactor Your Python Codeby@sourcerytim
4,339 reads
4,339 reads

10 Ways To Refactor Your Python Code

by Sourcery5mMarch 7th, 2021
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

10 ways to refactor your Python code to make it easier to understand, easier to work with, and just all around a bit more Pythonic. Don't repeat yourself! Hoist duplicate code out of conditionals and use list/set/dictionary comprehensions. Use any() instead of for loops to make your code easier to read, understand, and work with through automatic refactoring suggestions. Use lists to simplify the entire list creation into a single line and cut out the entire. line.

Company Mentioned

Mention Thumbnail
featured image - 10 Ways To Refactor Your Python Code
Sourcery HackerNoon profile picture
Sourcery

Sourcery

@sourcerytim

We help you make your Python code easier to read, understand, and work with through automatic refactoring suggestions!

Learn More
LEARN MORE ABOUT @SOURCERYTIM'S
EXPERTISE AND PLACE ON THE INTERNET.
L O A D I N G
. . . comments & more!

About Author

Sourcery HackerNoon profile picture
Sourcery@sourcerytim
We help you make your Python code easier to read, understand, and work with through automatic refactoring suggestions!

TOPICS

THIS ARTICLE WAS FEATURED IN...

Permanent on Arweave
Read on Terminal Reader
Read this story in a terminal
 Terminal
Read this story w/o Javascript
Read this story w/o Javascript
 Lite