mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-13 13:09:02 +08:00
Use exception instead of check if key is in dict
Since the amount of times that the key is in there is orders of magnitude larger, it's better to catch the exception when it doesn't (as that is slightly faster)
This commit is contained in:
parent
9c904f95ce
commit
eee84a82bf
@ -393,9 +393,11 @@ class CuraContainerStack(ContainerStack):
|
||||
if property_name == "settable_per_extruder":
|
||||
# Setable per extruder isn't a value that can ever change. So once we requested it once, we can just keep
|
||||
# that in memory.
|
||||
if key not in self._settable_per_extruder_cache:
|
||||
try:
|
||||
return self._settable_per_extruder_cache[key]
|
||||
except KeyError:
|
||||
self._settable_per_extruder_cache[key] = super().getProperty(key, property_name, context)
|
||||
return self._settable_per_extruder_cache[key]
|
||||
return self._settable_per_extruder_cache[key]
|
||||
|
||||
return super().getProperty(key, property_name, context)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user