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编码规范
pycharm提示This inspection detects any methods which may safely be made static.的更多相关文章
- pycharm提示This inspection detects instance attribute definition outside __init__ method
示例代码: class MiNiCarStore(CarStore): def createCar(self, typeName): self.carFactory = CarFactory() # ...
- 【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 ...
- 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 ...
- TortoiseGit做push时提示Disconnected: No supported authentication methods available (server sent: publickey)错误
通过Git从远程服务器上获得到自己的项目,但是通过TortoiseGit做push时提示Disconnected: No supported authentication methods availa ...
- pycharm 提示:this license **** has been cancelled(2)
pycharm安装激活过程中,提示 this license **** has been cancelled .这个问题并不是你的激活码不对,而是需要修改系统的hosts文件,下面详细讲解下如何修改h ...
- This inspection detects shadowing names defined in outer scopes.
错误信息:This inspection detects shadowing names defined in outer scopes. 检查到波浪处的单词已在函数外部定义. 解决:使用global ...
- 解决pycharm 提示no tests were found的问题
在使用pycharm,做日志模块封装,代码中觉得没有问题,运行就提示no tests were found 查询了下这个问题,原因是我创建的类名是以test方法开头,类似这样 不知道是不是把它默认当 ...
- pycharm提示your evalluation license has expired解决方法
安装pycharm,一段时间后提示your evalluation license has expired:打开pycharm--点击help--register--选中license server, ...
- PyCharm提示ModuleNotFoundError: No module named 'pymysql'
初学python,连接mysql时遇到了提示pymysql模块导入有问题,本人虽是window系统,解决思路是一样的 代码如下: import pymysql#打开数据库,参数依次为:主机名/IP,用 ...
随机推荐
- JDK源码笔记--Object
public final native Class<?> getClass(); public native int hashCode(); public boolean equals(O ...
- 在Linux环境下使用Apache部署ASP.NET Core
在前几篇文章中我们一起探讨了如何在Linux环境中安装ASP.NET Core运行时环境及将ASP.NET Core项目部署在Jexus中,这篇文章中我们将探讨如何将ASP.NET Core部署于Ap ...
- 20165231 预习作业3 linux安装及学习
linux安装 由于以前稍微关注过虚拟机相关知识,所以大致知道虚拟机软件的相关知识.目前我已知的普遍使用的虚拟机软件是VMware Workstation(下文简称VM),VirtualBox(下文简 ...
- Python-字符串的常用操作
name = "my name is irving and i am 22 years old!" #开头字母大写 print(name.capitalize()) #统计某字符个 ...
- FAT文件系统规范v1.03学习笔记---1.保留区之 Fat32 FSInfo扇区结构和备份启动扇区
1.前言 本文主要是对Microsoft Extensible Firmware Initiative FAT32 File System Specification中文翻译版的学习笔记. 每个FAT ...
- linux shell 进阶篇、shell脚本编程-创建函数
使用函数 #!/bin/bash # testing the script function myfun { echo "This is an example of a function&q ...
- 题解-hdu2866 Special Prime
Problem hdu-2866 题意:求区间\([2,L]\)有多少素数\(p\)满足\(n^3+pn^2=m^3\),其中\(n,m\)属于任意整数 Solution 原式等价于\(n^2(p+n ...
- thinkphp提示不支持mysqli或者mysql
确认php是否安装了php-mysql组件,nginx或apache的php服务进程
- 前端lvs访问多台nginx代理服务时出现404错误的处理
前端lvs访问多台nginx代理服务时出现404错误的处理 环境描述:app --> lvs --> nginx --> server app访问页面购买流量页面(nginx服务器) ...
- MySQL的连接数
我使用的数据库,没有针对其进行其他相关设置,最近经常出现连接异常,现象为太多的连接. MySQL查看最大连接数和修改最大连接数 1.查看最大连接数(可通过show variables查看其他的全局参数 ...