[PyMOAB] Range has no len attribute

Issue #57 resolved
Guilherme Caminha created an issue

The Range class has no len attribute. This breaks, for example, the tag_get_data method, when it is creating the data variable:

data = np.empty((length*len(entity_handles),),dtype=np.dtype(np_tag_type(tag_type)))

when entity_handles is a Range, which seems to be expected to happen. This can be fixed by creating a __len__ attribute on the Range class wrapper, similar to the size attribute, but I'm not sure if this should be done, so I'm creating this issue instead of a PR.

Comments (3)

  1. Patrick Shriwise

    Good catch. I think the only place this is a problem is in tag_get_data, but it should be remedied.

    I don't see a problem with adding a __len__ attribute to the pymoab Range class. Would you mind adding a test that exposes this bug?

  2. Log in to comment