mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-18 22:33:33 +00:00
entity_instance.__hash__ - reuse id() value for optimization
This commit is contained in:
@@ -536,8 +536,8 @@ class entity_instance:
|
|||||||
# Proper entity instances have a stable identity by means of the numeric
|
# Proper entity instances have a stable identity by means of the numeric
|
||||||
# step id. Selected type instances (such as IfcPropertySingleValue.NominalValue
|
# step id. Selected type instances (such as IfcPropertySingleValue.NominalValue
|
||||||
# always have id=0, so we hash <type, value, file pointer>
|
# always have id=0, so we hash <type, value, file pointer>
|
||||||
if self.id():
|
if id_ := self.id():
|
||||||
return hash((self.id(), self.wrapped_data.file_pointer()))
|
return hash((id_, self.wrapped_data.file_pointer()))
|
||||||
else:
|
else:
|
||||||
return hash((self.is_a(), self[0], self.wrapped_data.file_pointer()))
|
return hash((self.is_a(), self[0], self.wrapped_data.file_pointer()))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user