当前位置:网站首页>__getitem__和__setitem__
__getitem__和__setitem__
2022-06-28 02:07:00 【xx_xjm】
这里__setitem__和__setattr__有点相似,一个是在“对象.属性”的时候调用,一个是在“对象[item]”的时候调用
与__setattr__一样,设置属性要么用self.__dict__,要么用object(self, key,value)
两者差别在于,一个是a.属性的时候调用,一个是a[属性]的时候调用,a是任一个类的实例

参考自:(12条消息) python中 __setitem__()和 __setattr__()的区别_MY Qi的博客-CSDN博客
边栏推荐
- 您的物联网安全性是否足够强大?
- Simple file transfer protocol TFTP
- 《天天数学》连载53:二月二十一日
- How to judge that the thread pool has completed all tasks?
- Notepad++--常用的插件
- Writing C program with GCC and makefile for the first time
- 建立自己的网站(17)
- The horizontal scrolling recycleview displays five and a half in one screen, which is lower than the five average distributions
- PSM summary
- 元宇宙标准论坛成立
猜你喜欢
![Packet capturing and sorting out external Fiddler -- understanding the toolbar [1]](/img/5f/24fd110a73734ba1638f0aad63c787.png)
Packet capturing and sorting out external Fiddler -- understanding the toolbar [1]

More, faster, better and cheaper. Here comes the fastdeploy beta of the low threshold AI deployment tool!

2-5 basic configuration -win2003 add attack surface

剑指 Offer 49. 丑数(三指针法)

Le routage des microservices de la passerelle a échoué au chargement des ressources statiques des microservices

空闲中断无法清除

视频编解码性能优化与实现

您的物联网安全性是否足够强大?

Feign远程调用fallback回调失败,无效果

Summary of software testing tools in 2021 - fuzzy testing tools
随机推荐
s32ds跳转到DefaultISR
分布式事务—基于消息补偿的最终一致性方案(本地消息表、消息队列)
Is your IOT security strong enough?
Writing C program with GCC and makefile for the first time
[today in history] June 20: the father of MP3 was born; Fujitsu was established; Google acquires dropcam
【Kotlin】在Android官方文档中对其语法的基本介绍和理解
Simple file transfer protocol TFTP
Single page application (SPA) hash route and historical API route
PPT制作小技巧
js清空对象和对象的值:
Apache, IIS6 and ii7 independent IP hosts screen and intercept spider crawling (applicable to VPS virtual machine servers)
Online JSON to plaintext tool
访问网站提示:您未被授权查看该页恢复办法
CMU puts forward a new NLP paradigm - reconstructing pre training, and achieving 134 high scores in college entrance examination English
剑指 Offer 47. 礼物的最大价值(DP)
Usage details of staticlayout
Why are so many people keen on big factories because of the great pressure and competition?
[today in history] June 16: Oracle Bone Inscriptions was established; Microsoft MSX was born; The inventor of fast Fourier transform was born
分布式事务解决方案Seata-Golang浅析
Simple elk configuration to realize production level log collection and query practice