You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There were some comments here by @Caagr98 on how we can clean up our ability to access the Python stack, that we could try to incorporate. I haven't looked into them yet.
If anyone feels like updating our stack functionality to use this logic, you can edit the record_api/get_stack.py file.
In our usage we just need to be able to look at the ith item from the top of the stack, we never need to iterate through it all. So all we really need is the __getitem__ function to work on that OpStack class with negative indexes. Since performance is a concern here, we don't have any bounds checks.
Activity
Kyuuhachi commentedon Sep 7, 2020
Here's the simplified code I ended up with.
I'm not 100% certain I don't need to do anything about refcounts, but
py_objectprobably deals with that automatically.saulshanabrook commentedon Sep 7, 2020
@Caagr98 Awesome, thank you for this!
If anyone feels like updating our stack functionality to use this logic, you can edit the
record_api/get_stack.pyfile.In our usage we just need to be able to look at the
ith item from the top of the stack, we never need to iterate through it all. So all we really need is the__getitem__function to work on thatOpStackclass with negative indexes. Since performance is a concern here, we don't have any bounds checks.