当前位置:网站首页>__call__函数
__call__函数
2022-07-22 03:00:00 【Pr Young】
没有__call__函数:
class Person:
def hello(self,name):
print("hello"+name)
person=Person()
person.hello(“lisi”)
#输出得到:hellolisi
有__call__函数:
class Person:
def __call__(self,name):
print("hello"+name)
person=Person("lisi")
#输出得到:hellolisi
也就是说这个__call__函数其实就是一个构造函数
边栏推荐
- 【医学分割】Medical Image Segmentation Using Deep Learning: A Survey
- 单调栈框架
- [activity registration] stack a buff for your code! Click "tea" to receive the gift
- TDengine实验集群搭建 Success
- 上传图片到本机iis服务器,结果以网页地址形式返回,可直接访问
- LeetCode 0814. 二叉树剪枝
- ES6 - module
- ValueError: The truth value of a DataFrame is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or
- MySQL (28) - transaction related
- img.shape[-2:]/len(img.shape[-2:]):GeneralizedRCNN:original_image_sizes中的 torch._assert
猜你喜欢
Zero basic learning canoe panel (2) -- control layout
JMeter notes 1 | introduction and architecture of JMeter
Pyside2 as a simple browser
认识垃圾回收
A Recommendation for interface-based programming
LeetCode 0814. 二叉树剪枝
Kubernetes基础部分学习笔记
浏览器无痕浏览还能查到记录吗,如何开启无痕模式
Still asking what to use for interface testing? Universal JMeter creates a performance test data platform
上传图片到本机iis服务器,结果以网页地址形式返回,可直接访问
随机推荐
Basic concept of Nacos and single machine startup
60道测开面试题,背完直接涨工资
Clickhouse related SQL summary: create table, partition / primary key / sorting settings, delete table, delete partition, modify table fields
深度学习之 8 深度模型优化与正则化2
Bi analytical thinking of business intelligence: cash cycle of manufacturing industry (II)
Tdengine learning notes
EACCES: permission denied, unlink ‘/usr/local/bin/code‘
JS advanced ES6 implementation inheritance
9 good habits improve your happiness
TiDB中规划的集群包括6个DB,3个pd,3个kv,应用去连的时候,是连哪个地址?
PLT draw and save the results
Know garbage recycling
Creation and call of QT dynamic DLL
nacos基础概念和单机启动
单调栈框架
Chapter 3 - creating and maintaining MySQL data tables
商品信息SKU数据库设计
vlc报错——“live555 error: no data received in 10s, aborting”
C语言编写九九乘法表,实现不同三角形形状表格输出
v-if、v-for、列表的过滤与排序、强制绑定class和style、收集表单信息