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

TypeError in TaggedList's __setitem__ and __delitem__ #12

Open
rjmorris opened this issue Jun 16, 2016 · 1 comment
Open

TypeError in TaggedList's __setitem__ and __delitem__ #12

rjmorris opened this issue Jun 16, 2016 · 1 comment

Comments

@rjmorris
Copy link

I tried to assign a value to a TaggedList element, but I got the following error:

TypeError: 'builtin_function_or_method' object is not subscriptable

The cause appears to be a mistake in how the index function is called in __setitem__: square brackets are used instead of parentheses. __delitem__ has the same mistake. Compare to __getitem__, which works correctly. The following is from the TaggedList definition in taggedContainers.py from master:

    def __getitem__(self, i):
        if type(i) == str:
            i = self.keys.index(i)
        return self.values[i]

    def __setitem__(self, i, item):
        if type(i) == str:
            i = self.keys.index[i]
        self.values[i] = item

    def __delitem__(self, i):
        if type(i) == str:
            i = self.keys.index[i]
            del self.keys[i]
        del self.values[i]
@ralhei
Copy link
Owner

ralhei commented Jun 21, 2016

Hi rjmorris, yes, this is indeed a bug. I have to revise this class anyway, hope to get there soon.

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