博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
@classmethod and @staticmethod
阅读量:6554 次
发布时间:2019-06-24

本文共 587 字,大约阅读时间需要 1 分钟。

hot3.png

@classmethod means: when this method is called, we pass the class as the first argument instead of the instance of that class (as we normally do with methods). This means you can use the class and its properties inside that method rather than a particular instance.

means: when this method is called, we don't pass an instance of the class to it (as we normally do with methods). This means you can put a function inside a class but you can't access the instance of that class (this is useful when your method does not use the instance).

转载于:https://my.oschina.net/hnuweiwei/blog/1058171

你可能感兴趣的文章
LeetCode - 33. Search in Rotated Sorted Array
查看>>
[LeetCode]: 206: Reverse Linked List
查看>>
nginx+apache 404错误页面
查看>>
leetcode 566 Reshape the Matrix 重塑矩阵
查看>>
Java基础语法 - 面向对象 - static 关键字
查看>>
ruby变量
查看>>
(WPF&Silverlight)可空,null
查看>>
开启、关闭数据库mysql
查看>>
什么是Shell脚本
查看>>
性能测试浅谈
查看>>
数据持久化以及沙盒路径
查看>>
2019 -2-15 复习
查看>>
ZeroMQ指南-前言 ...
查看>>
vim锁定屏幕
查看>>
IPv4选项
查看>>
FL2440 ubifs文件系统烧录遇到的问题——内核分区的重要性
查看>>
实用的 JavaScript 调试小技巧
查看>>
使用迭代器
查看>>
stm32模拟iic——引脚配置、代码
查看>>
用JavaScript探测页面上的广告是否被AdBlock屏蔽了的方法
查看>>