mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-20 13:17:51 -06: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
1 changed files with 4 additions and 2 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue