Incidencia #44574

generate_packets.py: phase out use of __dict__ in formatting

Abrir Fecha: 2022-05-13 05:19 Última actualización: 2022-05-16 21:14

Informador:
Propietario:
Tipo:
Estado:
Cerrado
Componente:
Hito:
Prioridad:
5 - Medium
Gravedad:
5 - Medium
Resolución:
Fixed
Fichero:
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).

Ticket History (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
  • Resolución Update from Ninguno to Accepted
Comentario

Depends on #44563 and #44576

2022-05-16 21:14 Updated by: alienvalkyrie
  • Resolución Update from Accepted to Fixed
2022-05-16 21:14 Updated by: alienvalkyrie
  • Estado Update from Open to Cerrado

Editar

You are not logged in. I you are not logged in, your comment will be treated as an anonymous post. » Entrar