![]() ![]() In face of ambiguity, resist the temptation to guess. There are cases when you know about the error and you decided to live with it. Unless explicitly silencedĪgain a case of last rules. ![]() Your program should scream if there is an error to save itself. They should be caught as early as possible. Errors should never pass silently.Īnd to add to these. These are the cases where you have to break the special case clause. Well, there can because when you have to make exceptions to make it usable. There are rules made as in programming concepts. Everything should be built by keeping general things in mind. If you start adding exceptions you will end up in a mess of exceptions. Special cases aren’t special enough to break the rules. But a word to those who things that their code is better just because a normal coder can’t understand this. Well, I don’t think I should explain more. Write things in different modules, so it will be easier to understand what each module accomplishes. This is somewhat related to a modular code. if you have a poorly written if-else statement your code will be tougher to understand. Nesting does not always increase complexity. Also, nesting increases the time complexity of the code. The more the nesting more complicated it becomes to understand the code. Complex vs complicated Flat is better than nested. But what I can think of is that making things complicated for someone to use it. Well, it’s really complex to tell what this means, I am also confused here. ![]() Cool is not always beautiful □ The complex is better than complicated Don’t try to do something in a complex way just because they look cool. Yes and this will help the next guy to understand it easily. It should not have implicit behaviour Simple is better than complex. Your code is as transparent as it can be. What this means is that if you can define something you should and should not the code to handle it implicitly because it hides information. And humans are special they are not beautiful or ugly. It the perspective of everyone and it can differ :). Mind it there is nothing ugly and beautiful in real life. This was just an example in general you should write code in a well-formatted and simple manner. The way you write python code itself makes it beautiful. This is from where the python indentation system must be carved out from. In this article, we are going to see what these philosophies tell us exactly. When you press enter few philosophies will come up and these are called the zen of python. Namespaces are one honking great idea - let's do more of those! If the implementation is easy to explain, it may be a good idea. If the implementation is hard to explain, it's a bad idea. There should be one- and preferably only one -obvious way to do it.Īlthough that way may not be obvious at first unless you're Dutch.Īlthough never is often better than *right* now. In the face of ambiguity, refuse the temptation to guess. Special cases aren't special enough to break the rules. Have you heard of zen of python? If not why don’t you type the below command in the python console. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |