![]() Drawing once more on this lovely stranger, “languages and libraries should aim for consistency and should support the general case.” ĩ. Special cases aren’t special enough to break the rules. Think about indentation and how much easier it is to read code that is.Ĩ. Many of these rules seem to overlap in their logic. In short, “don’t try to stick too much code on one line.” Although efficiency is key (and much appreciated), being too paragraph-y will stress the reader out and make it hard to read your code.ħ. ![]() According to the best explanation ever, flat is “… typically easier and faster to parse, and should be preferred … where you need nested data structures, prefer shallow rather than deeply nested”. Think about the main difference between Data Analytics and Data Science: in x you have the questions but not the answers, while in y you have neither the questions nor the answers.ĥ. Next, let’s instead say she asks me to take her to a restaurant she will enjoy (:complicated). Let’s say my imaginary girlfriend asks me to make her a three-course meal for her birthday (:complex). I want to re-route the wrong answers to again leading to a Yes or No response - or rather, x or y response - so that my users are never confused as to which responses they are prompted to give.Ĥ. I want to write a lot of raw_input code for users to have only 2–3 options: Yes, No, or wrong. According to Brazilian software developer Vitor Freitas, “a simple solution is always better than a complex one.” (Try import this in Python.) Similarly, I have an idea for my first program. Let your code be readable by a stranger who knows nothing about you or your program.ģ. I interpret this from my days of writing poetry: be concrete, not abstract. This may refer to “explicitly naming modules when invoking them in functions.” In general, be specific. According to Soumya Ghost, “Python succeeds at being precise, concise, explicit and elegant at the same time.” Is your code as pretty?Ģ. Rather than using & or|| as logical operators, consider using and || or, if it works & is readable to you. ![]() They do it way better than I do!ġ.Beautiful is better than ugly. Below the list is the link for that.Įdit: Check out in the citations. Written below is a brief analysis of each rule, taken in large part from an article I read on. Apparently there is a 20th, but I’m focusing on understanding the written list before speculating on what the Easter Egg could be. The Zen of Python - is a list of 19 general truths for Python design principles.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |