entity_instance.__hash__ - reuse id() value for optimization

This commit is contained in:
Andrej730
2025-06-13 17:03:50 +05:00
parent 67b539aba1
commit 9b8357c5ec
@@ -536,8 +536,8 @@ class entity_instance:
# Proper entity instances have a stable identity by means of the numeric
# step id. Selected type instances (such as IfcPropertySingleValue.NominalValue
# always have id=0, so we hash <type, value, file pointer>
if self.id():
return hash((self.id(), self.wrapped_data.file_pointer()))
if id_ := self.id():
return hash((id_, self.wrapped_data.file_pointer()))
else:
return hash((self.is_a(), self[0], self.wrapped_data.file_pointer()))