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

Potential bug in _reset_index #31

Open
mdfirman opened this issue Jan 4, 2021 · 0 comments
Open

Potential bug in _reset_index #31

mdfirman opened this issue Jan 4, 2021 · 0 comments

Comments

@mdfirman
Copy link

mdfirman commented Jan 4, 2021

SafeDataset._reset_index is defined as follows:

    def _reset_index(self):
        """Resets the safe and unsafe samples indices."""
        self._safe_indices = self._unsafe_indices = []

I believe this has a bug, as after calling this function _safe_indices and _unsafe_indices will both point to the same underlying list in memory.

Compare:

>> a = []
>> b = []
>> a.append(2)
>> print(b)
[]
  --> expected!

with

>> a = b = []
>> a.append(2)
>> print(b)
[2]
  --> unexpected!
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

1 participant