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编码规范

转载于:https://www.cnblogs.com/weibgg/p/10786957.html

你可能感兴趣的:(pycharm提示This inspection detects any methods which may safely be made static.)