任务单 #44574

generate_packets.py: phase out use of __dict__ in formatting

开放日期: 2022-05-13 05:19 最后更新: 2022-05-16 21:14

报告人:
属主:
类型:
状态:
关闭
组件:
里程碑:
优先:
5 - Medium
严重性:
5 - Medium
处理结果:
Fixed
文件:
1

Details

Part of #43927. Accessing instance variables for string interpolation via an object's __dict__ makes it impossible to use properties (or any other descriptors), and makes it less clear that an instance variable is being used (e.g. searching for ".name" would not find these uses).

While f-strings (the preferred formatting solution) are only available from Python 3.6 onward, str.format() supports member access; e.g. "%(foo)s, %(bar)s" % self.__dict__ can be written as "{self.foo}, {self.bar}".format(self = self).

任务单历史 (3/5 Histories)

2022-05-13 05:19 Updated by: alienvalkyrie
  • New Ticket "generate_packets.py: phase out use of __dict__ in formatting" created
2022-05-13 05:42 Updated by: alienvalkyrie
  • 处理结果 Update from to Accepted
评论

Depends on #44563 and #44576

2022-05-16 21:14 Updated by: alienvalkyrie
  • 处理结果 Update from Accepted to Fixed
2022-05-16 21:14 Updated by: alienvalkyrie
  • 状态 Update from 开启 to 关闭

编辑

Please login to add comment to this ticket » 登录名