pycharm提示This inspection detects any methods which may safely be made static.

示例代码:

class Car(object):
	# 未定义任何类属性

    def move(self):  # 方法会出现下划线提示This inspection detects any methods which may safely be made static.
        print("---车在移动---")

    def stop(self):
        print("---停车---")

原因是该方法不涉及对该类属性的操作,编译器建议声明为@staticmethod,面向对象思想体现

扩展知识
PEP8编码规范

posted @ 2019-01-23 22:47  每一天,为明天。  阅读(355)  评论(0)    收藏  举报