You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: readme.md
+49-1Lines changed: 49 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ At first glance, Python and Ruby appear to be very similar languages. Both are h
4
4
5
5
Well, with a dynamically typed language you can do this:
6
6
7
-
```python
7
+
```sh
8
8
>>> variable = 1
9
9
>>> type(variable)
10
10
<type 'int'>
@@ -20,4 +20,52 @@ Essentially, I can change the datatype (from an integer to a string to a list, i
20
20
21
21
Both support multiple programming paradigms as well - e.g, procedural, functional, object oriented, and so forth.
22
22
23
+
However, there are a number of differences ..
23
24
25
+
### The Python Way
26
+
27
+
Open your terminal and open the Python shell then type `import this`:
28
+
29
+
```sh
30
+
>>> import this
31
+
The Zen of Python, by Tim Peters
32
+
33
+
Beautiful is better than ugly.
34
+
Explicit is better than implicit.
35
+
Simple is better than complex.
36
+
Complex is better than complicated.
37
+
Flat is better than nested.
38
+
Sparse is better than dense.
39
+
Readability counts.
40
+
Special cases aren't special enough to break the rules.
41
+
Although practicality beats purity.
42
+
Errors should never pass silently.
43
+
Unless explicitly silenced.
44
+
In the face of ambiguity, refuse the temptation to guess.
45
+
There should be one-- and preferably only one --obvious way to do it.
46
+
Although that way may not be obvious at first unless you're Dutch.
47
+
Now is better than never.
48
+
Although never is often better than *right* now.
49
+
If the implementation is hard to explain, it's a bad idea.
50
+
If the implementation is easy to explain, it may be a good idea.
51
+
Namespaces are one honking great idea -- let's do more of those!
52
+
```
53
+
54
+
This is what is known as the [Zen of Python](http://www.python.org/dev/peps/pep-0020/), which are the guiding principles of Python. These 19 guidelines can be trimmed to five points:
55
+
1. Beautiful is better than ugly.
56
+
2. Explicit is better than implicit.
57
+
3. Simple is better than complex.
58
+
4. Complex is better than complicated.
59
+
5. Readability counts.
60
+
61
+
Essentially, Pythonists value code readability and productivity over all else.
62
+
63
+
> Check out [this](http://stackoverflow.com/questions/228181/the-zen-of-python) StackOverflow question to see examples of all the guidelines in use.
64
+
65
+
Finally, if shortened to one major point-
66
+
67
+
*There should be one – and preferably only one – obvious way to do it*
68
+
69
+
-we get to one of the main differences between Python and Ruby ..
0 commit comments