Stop Writing Python Functions that Take more than 3 Minutes to Understand
Have you ever looked at a function you wrote one month earlier and found it difficult to understand in 3 minutes? If that is the case, it is time to refactor your code. If it takes you more than 3 minutes to understand your code, imagine how long it would take for your teammates to understand your code.
If you want your code to be reusable, you want it to be readable. Writing clean code is especially important to data scientists who collaborate with other team members in different roles.
You want your Python function to:
These practices will make your functions more readable and easier to detect errors.
Inspired by the book _Clean Code: A Handbook of Agile Software Craftsmanship _by Robert C. Martin with code examples written in Java, I decided to write an article on how to write clean code in Python for data scientists.
In this article, I will show you how to utilize the 6 practices mentioned above to write better Python functions.
Guide to Python Programming Language
This article will explore how to generate QR code in Python and some useful creation features from pyqrcode library. QR codes recently became more popular than ever before, yet few people know that the first iterations of QR codes were created back in 1990s in Japan for the automotive industry.
Python is an interpreted, high-level, powerful general-purpose programming language. You may ask, Python’s a snake right? and Why is this programming language named after it?
Python Hello World Program - Your first step towards Python world. Learn how to create the Hello World Python program in PyCharm.
Python Programming Tutorials For Beginners