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

OrderedSet.index(...) function throws error when key is a frozenset #95

Open
KSneijders opened this issue Oct 28, 2023 · 1 comment
Open

Comments

@KSneijders
Copy link

I'm unable to use OrderedSet.index(...) function with frozensets as values. It throws an error when the key is a frozenset.

Code to recreate the error:

os = OrderedSet([frozenset([1, 2])])
i = os.index(frozenset([1, 2]))
Traceback (most recent call last):
  File "<PATH>\src\main.py", line 11, in <module>
    i = os.index(frozenset([1, 2]))
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<PATH>\Python311\Lib\site-packages\ordered_set\__init__.py", line 246, in index
    return [self.index(subkey) for subkey in key]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<PATH>\Python\Python311\Lib\site-packages\ordered_set\__init__.py", line 246, in <listcomp>
    return [self.index(subkey) for subkey in key]
            ^^^^^^^^^^^^^^^^^^
  File "<PATH>\Python\Python311\Lib\site-packages\ordered_set\__init__.py", line 247, in index
    return self.map[key]
           ~~~~~~~~^^^^^
KeyError: 1

Thanks for this amazing utility!

@KSneijders
Copy link
Author

@rspeer Hey, sorry for the ping- is this package still in 'active' development? 🙂

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