Use enumerate to iterate over self._types

This is more pythonic.
The comparaison in the if block below the for loop now becomes clearer.
This commit is contained in:
digitalfrost 2022-08-05 10:37:02 +02:00
parent 3c9d38ebd4
commit 9ac7eb4da7

View File

@ -39,10 +39,10 @@ class LayerPolygon:
self._extruder = extruder
self._types = line_types
for i in range(len(self._types)):
if self._types[i] >= self.__number_of_types: # Got faulty line data from the engine.
Logger.log("w", "Found an unknown line type: %s", i)
self._types[i] = self.NoneType
for idx, line_type in enumerate(self._types):
if line_type >= self.__number_of_types: # Got faulty line data from the engine.
Logger.log("w", "Found an unknown line type: %s", line_type)
self._types[idx] = self.NoneType
self._data = data
self._line_widths = line_widths
self._line_thicknesses = line_thicknesses