![]() The explicit code is the one that doesn’t require some further understanding of the code behind what is shown on the code, it is clean, simple and more expresive that the implicit version. The sense of beauty on the code is trained over the experience so it is normal to get that sense over the time. So it is recommended that every time you read Python, you have the feeling that the code is beautiful, otherwise try to rewrite it in a more beautiful way. Namespaces are one honking great idea - let's do more of those!Įven if usually the beautiful or ugliness of a something is subjective, when reading code, usually we use expressions like it stinks or doesn’t look right, that are similar to say that code is ugly. 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. The rules are written into the PEP 20 and can be found here: but on this post you will find them and examples of how to apply them.Įvery Python interpreter has an easy way to pull the zen of Python, just typing import this > import this There are only 19 rules to build code in Python and to unify the criteria on which decisions should be taken in case of doubts. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |