目录技术背景实现步骤1. 使用len()函数2. 自定义计数函数3. 使用operator.length_hint()(python 3.4+)4. 自定义类并添加length属性核心代码最佳实践常见问题技术背景