示例代码:

class Car(object):
# 未定义任何类属性 def move(self): # 方法会出现下划线提示This inspection detects any methods which may safely be made static.
print("---车在移动---") def stop(self):
print("---停车---")

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

扩展知识

PEP8编码规范

pycharm提示This inspection detects any methods which may safely be made static.的更多相关文章

  1. pycharm提示This inspection detects instance attribute definition outside __init__ method

    示例代码: class MiNiCarStore(CarStore): def createCar(self, typeName): self.carFactory = CarFactory() # ...

  2. 【PyCharm编辑器】之无法导入引用手动新建的包或类,报:This inspection detects names that should resolve but don't. Due to dynamic dispatch and duck typing, this is possible in a limited but useful number of cases.

    一.现象描述 如下图所示,手动新建个类包calculator.py,想在test.py文件引用它,发现一直报红线,引用失败 Unresolved reference 'calculator' less ...

  3. this inspection detects names that should resolved but don't. Due to dynamic dispatch and duck typing, this is possible in a limited but useful number of cases. Top-level and class-level items are sup

    输入第一行代码:import logging;logging.basicConfig(level==logging.INFO) 提示:this inspection detects names tha ...

  4. TortoiseGit做push时提示Disconnected: No supported authentication methods available (server sent: publickey)错误

    通过Git从远程服务器上获得到自己的项目,但是通过TortoiseGit做push时提示Disconnected: No supported authentication methods availa ...

  5. pycharm 提示:this license **** has been cancelled(2)

    pycharm安装激活过程中,提示 this license **** has been cancelled .这个问题并不是你的激活码不对,而是需要修改系统的hosts文件,下面详细讲解下如何修改h ...

  6. This inspection detects shadowing names defined in outer scopes.

    错误信息:This inspection detects shadowing names defined in outer scopes. 检查到波浪处的单词已在函数外部定义. 解决:使用global ...

  7. 解决pycharm 提示no tests were found的问题

    在使用pycharm,做日志模块封装,代码中觉得没有问题,运行就提示no  tests were found 查询了下这个问题,原因是我创建的类名是以test方法开头,类似这样 不知道是不是把它默认当 ...

  8. pycharm提示your evalluation license has expired解决方法

    安装pycharm,一段时间后提示your evalluation license has expired:打开pycharm--点击help--register--选中license server, ...

  9. PyCharm提示ModuleNotFoundError: No module named 'pymysql'

    初学python,连接mysql时遇到了提示pymysql模块导入有问题,本人虽是window系统,解决思路是一样的 代码如下: import pymysql#打开数据库,参数依次为:主机名/IP,用 ...

随机推荐

  1. Required String parameter 'images' is not present

    后台控制层控制为非必填即可: @RequestMapping("/addDo") @SJson @SLog(description = "Car_main") ...

  2. vue 中通过 ajax 获取数据时,如何避免绑定的数据中出现 property of undefined 错误

    参考链接:https://segmentfault.com/q/1010000008264089?_ea=1597485

  3. Tesseract识别图片提取文字&字库训练

    文中测试了3.0和4.0两个版本.发现3.0识别效率不准确,需要训练词库.4.0识别效率就比较高了,而且支持结果生成pdf.txt等格式.所以推荐使用4.0版本. 这个工具可以用在爬虫的时候获取验证码 ...

  4. Java HashMap工作原理及实现[转]

    原文:http://yikun.github.io/2015/04/01/Java-HashMap%E5%B7%A5%E4%BD%9C%E5%8E%9F%E7%90%86%E5%8F%8A%E5%AE ...

  5. P1456 Monkey King

    题目地址:P1456 Monkey King 一道挺模板的左偏树题 不会左偏树?看论文打模板,完了之后再回来吧 然后你发现看完论文打完模板之后就可以A掉这道题不用回来了 细节见代码 #include ...

  6. NUMA的取舍与优化设置【转】

    NUMA的取舍与优化设置 在os层numa关闭时,打开bios层的numa会影响性能,QPS会下降15-30%; 在bios层面numa关闭时,无论os层面的numa是否打开,都不会影响性能. 安装n ...

  7. struts2框架学习之第三天

    day03 上传下载 1        上传下载组件介绍 l  jspSmartUpload(model1的年代): l  apache-commons-fileupload,Struts2默认上传组 ...

  8. gnutls-3.5.18 static building for windows

    gnutls-3.5.18 static building for windows Required libraries:1. libnettle 2. gmplib Optional librari ...

  9. T-SQL 数值函数

    MS SQL Server数字函数可以应用于数值数据,并返回数值数据. 下面是带有示例的数值函数列表. ABS() 输出给定值的绝对值. 例 以下查询将输出-22的绝对值:22. Select ABS ...

  10. eclipse:显示堆内存

    如下图 :