阅读对象:
Pycharm的初级使用者,经常发现一些报错,不知道怎么去解决的人,可以扫一眼
具体的报错:
1. Instance attribute my_project defined outside __init__
这个主要就是需要先定义,后使用,所以,需要在
def __init__中把这个变量定义一下:
self.my_project = None
2. function ** lacks positional argument
主要是因为装饰器,只需要把装饰器挪到外面就可以了
'module' object is not callable
主要是模块的引用,TOBE解决
优化
This dictionary creation could be rewriten as a dictionary literal:
one_rol = {}
one_rol['name'] = 'zhangsan'
one_rol['age'] = 23
需要修改为:
one_rol = {'name': zhangsan, 'age': 23}
Simplify chained comparison
我们遇到的情况是:if A>10 and A<20
python建议我们写成 if 10 < A < 20
default argument value is mutable
这个报错是有危害的,具体参考,最好修复,要不然遇到问题都会懵
使用mutable对象作为Python函数参数默认值潜在的危害(Default argument is mutable)-CSDN博客