python 命名规范最近遇到的问题

1.remove redundant parentheses

 出去多余的括号,写C#习惯了先加个括号,python的if不用加括号。

改为:if chrome_args().get("headless_flag") == "1":

2.Instance attribute xxx defined outside init

所有的属性都应该定义在init里面。

3.too broad exception clause

就是字面含义,你捕获的异常过于宽泛了,没有针对性,可以通过指定精确的异常类型来解决

 

posted @ 2018-02-23 11:17  公众号python学习开发  阅读(704)  评论(0编辑  收藏  举报