Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Python] File3dmObjectTable.__getitem__() does not accept negative indexing #651

Open
StudioWEngineers opened this issue Oct 22, 2024 · 1 comment

Comments

@StudioWEngineers
Copy link

In Python negative indexing is possible, so I would expect this to work:

import rhino3dm

model = rhino3dm.File3dm()

for i in range(2):
    model.Objects.AddPoint(rhino3dm.Point3d(i, 0, 0))
    print(model.Objects[-1].Geometry.Location)

print(model.Objects[-2].Geometry.Location)

However, this does not work because of:

throw pybind11::index_error();

I would be happy to prepare a PR to make the behaviour of File3dmObjectTable.__getitem__() closer to a Python list, but I am wondering if this would be considered acceptable.

@sbaer
Copy link
Member

sbaer commented Oct 23, 2024

I don't see any downside to supporting negative indexing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants