Ticket #44574

generate_packets.py: phase out use of __dict__ in formatting

Eröffnet am: 2022-05-13 05:19 Letztes Update: 2022-05-16 21:14

Auswertung:
Verantwortlicher:
Typ:
Status:
Geschlossen
Komponente:
Meilenstein:
Priorität:
5 - Mittel
Schweregrad:
5 - Mittel
Lösung:
Gefixt
Datei:
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-Verlauf (3/5 Historien)

2022-05-13 05:19 Aktualisiert von: alienvalkyrie
  • New Ticket "generate_packets.py: phase out use of __dict__ in formatting" created
2022-05-13 05:42 Aktualisiert von: alienvalkyrie
  • Lösung Update from Keine to Accepted
Kommentar

Depends on #44563 and #44576

2022-05-16 21:14 Aktualisiert von: alienvalkyrie
  • Lösung Update from Accepted to Gefixt
2022-05-16 21:14 Aktualisiert von: alienvalkyrie
  • Status Update from Offen to Geschlossen

Bearbeiten

Please login to add comment to this ticket » Anmelden