@
0987363 In Python:
if a is b and c is not d or e:
print("I got it!")# 根据以往的经验,这里的缩进会少
In C Style Programming Languages:
if (a == b && c!=d || e){echo("What's that! Bullshit!");}
如果你把它拆开的话:
if (a == b && c!=d || e){
echo("What's that! Bullshit!");
}//多了一行!完全没必要的一行!
另外,有一个很纠结的问题:
1. if[空格]()[空格]{}
2. if()[空格]{}
3. if[空格](){}
4. if[空格]()
{}
5. if()
{}
你想害死强迫症吗?!
Otherwise, if you use non-blocking model(Like Node.js):
var = require("fs");
result = function (){
fs.readFile("hehe.json", function (){
... ...
console.log("Where am I");
});
}
如果你用Python你就不会这样了,因为他没有匿名函数,你必须为函数命名:
import tornado.web
import tornado.httpclient
import tornado.ioloop
class SampleHanler(BaseHandler):
@
tornado.web.asynchronous
def get(self):
HttpClient = tornado.httpclient.AsyncHTTPClient()
link = "
http://www.google.com/"
HttpClient.fetch(link, callback = self.callback)
def callback(self, response):
print(response.body)
这样是很清晰的!C(Especially PHP)是灰常凌乱的!