《CPython Internals》阅读笔记:p285-p328

《CPython Internals》学习第 15天,p285-p328 总结,总计 44 页。

一、技术总结

1.shallow comparison

p285, In Objects object.c, the base implementation of the object type is written in pure C code. There are some concrete implementations of basic logic, like shallow comparisons(《CPython Internals》第285页)。

shallow 和 deep这两个词常见于 copy(shallow copy, deep copy) 和 comparison(shallow comparison, deep comparison) 操作中。

但是个人觉得从字面意思不好理解。示例:TBD。

2.dunder method

All these functions can be overridden in a custom object by implementing dunder methods on a Python object(《CPython Internals》第286页)。

看到 dunder methods, 一下子没反应过来什么样的方法叫 dunder methods, dunder 是什么意思?查了下,dunder是 double under的缩写,其实是为了发音(pronunce)方便, 由 Mark Jackson提出:

An awkward thing about programming in Python: there are lots of double underscores. [snip] My problem with the double underscore is that it’s hard

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值