-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathzen_of_python.py
48 lines (42 loc) · 1.71 KB
/
zen_of_python.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
"""Zen of Python.
Behold the cave of Caerbannog!
. . . Look, that rabbit's got a vicious streak a mile wide! It's a killer!"""
import this
"""Now, you siblings of King Arthur, assist his squire, Patsy, and go slay the Beast!
.....
Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren't special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.
In the face of ambiguity, refuse the temptation to guess.
There should be one-- and preferably only one --obvious way to do it.
Although that way may not be obvious at first unless you're Dutch.
Now is better than never.
Although never is often better than *right* now.
If the implementation is hard to explain, it's a bad idea.
If the implementation is easy to explain, it may be a good idea.
Namespaces are one honking great idea -- let's do more of those!
Styles notes - chapter 4
PEP 8 - Style guide.
four space indent
don't mix tabs and spaces.
limit characters to 79 per line (72 to 99)
blank lines group your code.
to break long lines of text: break the text. add new line.
indent if necessary. continue string. Repeat if longer than x-num/lines.
Modules:
Add the import for other modules/sub modules at the first line of code.
Class names should be written in CamelCase. (HorseCase not required.)
Don't use underscores.
Have a docstring for the module at the beginning.
Have a docstring after the class definition
Have a docstring after the methods
One blank line between methods. Two blank lines between classes.
"""