Skip to content

Conversation

@progval
Copy link
Contributor

@progval progval commented Mar 15, 2016

They call self.boundary_table.iloc[0] (resp. [-1]), and self.boundary_table is a SortedDict.
SortedDict.iloc is an instance of _IlocWrapper, whose __getitem__ only does: return self._dict._list[index]
_dict is the SortedDict instance, and _dict._list is an instance of SortedList.
Finally, SortedList.__item__ has special cases to perform in O(1) when the index is 0 or -1.

References:

They call self.boundary_table.iloc[0] (resp. [-1]), and self.boundary_table
is a SortedDict.
SortedDict.iloc is an instance of _IlocWrapper, whose __getitem__ only
does: return self._dict._list[index]
_dict is the SortedDict instance, and _dict._list is an instance of
SortedList.
Finally, SortedList.__item__ has special cases to perform in O(1)
when the index is 0 or -1.

References:
* https://github.com/grantjenks/sorted_containers/blob/ccec8d4/sortedcontainers/sorteddict.py#L34-L40
* https://github.com/grantjenks/sorted_containers/blob/b62fe6a/sortedcontainers/sortedlist.py#L599-L602
@chaimleib chaimleib changed the base branch from master to dev December 10, 2017 19:23
@chaimleib
Copy link
Owner

Thanks!

@chaimleib chaimleib merged commit 02f40c6 into chaimleib:dev Dec 10, 2017
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

Successfully merging this pull request may close these issues.

2 participants