Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
ptx
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
176 ms
·
2101.
▲
by
ptx
13y ago
>>> print(object() > object()) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: unorderable types: object() > object() Yet another reason to upgrade to Py
2102.
▲
by
ptx
13y ago
Well, the colon can be used without indentation if the block that follows is just a single line: def embiggen(x): return x * 2 for i in range(10): print(embiggen(x)) Also, it just makes things read more naturally to us humans, I th
2103.
▲
by
ptx
13y ago
When you have both braces/keywords and whitespace, it seems to me that you're essentially storing the same information about the program structure in two places, of which one is read by the machine and the other is read by humans.
2104.
▲
by
ptx
13y ago
Python (assuming that the last line ends with a newline): import sys open(sys.argv[2], "w").writelines(sorted(open(sys.argv[1])))