mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-17 22:11:36 +00:00
Raise IndexError
This commit is contained in:
@@ -80,6 +80,8 @@ class entity_instance(object):
|
|||||||
self[self.wrapped_data.get_argument_index(key)] = value
|
self[self.wrapped_data.get_argument_index(key)] = value
|
||||||
|
|
||||||
def __getitem__(self, key):
|
def __getitem__(self, key):
|
||||||
|
if key < 0 or key >= len(self):
|
||||||
|
raise IndexError("Attribute index {} out of range for instance of type {}".format(key, self.is_a()))
|
||||||
return entity_instance.wrap_value(self.wrapped_data.get_argument(key))
|
return entity_instance.wrap_value(self.wrapped_data.get_argument(key))
|
||||||
|
|
||||||
def __setitem__(self, idx, value):
|
def __setitem__(self, idx, value):
|
||||||
|
|||||||
Reference in New Issue
Block a user