![]() ![]() While doing the dishes with a pressure washer is impractical, using the pressure washer may be the right way to go if you’re cleaning a car. Python programmers must avoid overcomplicating their solutions, even if they may look smart and work.Ĭomplicating your programs will ultimately do more damage, and your team will not appreciate it. Not to mention, it is a daft solution to the problem.īy the same token, writing complex code to solve a simple program is impractical. Pulling out a pressure washer to clean the dishes after dinner might be one way to go about it, but it’ll likely damage the plates. Put simply, you must write code that another programmer with no previous knowledge of the program should be able to understand how it’s working. ![]() Python programmers need to do everything they can to ensure that the functionality of their code doesn’t get hidden behind hard-to-understand language. The idea behind this aphorism is that writing verbose code is better than writing indirect code. But many fail to implement it when they code. Reading this observation, one could conclude that it’s self-explanatory. Removing unnecessary conditions and simplifying your solutions will make your code beautiful. In other words, if a program works fine, it does not mean it’s beautiful and elegant. However, the rule of thumb is that the code must be easy to understand for any developer looking at it. Ideally, the code needs to be readable and elegant.īut what makes code “beautiful”? Just like in life, beauty is subjective in Python programming. Programmers are problem-solving experts, but since writing, documenting, and maintaining Python code is typically a team effort, plainly crafting a solution to a problem is not enough. The Zen of Python: A Breakdown #1 Beautiful is Better Than Ugly We discuss the meanings of the aphorisms and how they can help you improve your code in this post. Python includes the collection as an easter egg, and you can read the list of aphorisms by running “import this” on the interpreter. ![]() Bearing these observations in mind when writing code is not mandatory, but it certainly helps ensure quality code. The collection was standardized in 2004 as PEP 20 since it significantly impacted the Python community’s programming process. While the original collection had 20 aphorisms, Guido van Rossum dismisses the final one as a bizarre joke by Peters. The Zen of Python is a collection of 19 observations noted by Tim Peters, one of the creators of Python. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |