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

Error when parsing ExtSlice #17

Open
DevOlly opened this issue Mar 21, 2018 · 2 comments
Open

Error when parsing ExtSlice #17

DevOlly opened this issue Mar 21, 2018 · 2 comments

Comments

@DevOlly
Copy link

DevOlly commented Mar 21, 2018

When parsing complex slicing expressions, like classes[:, :-1], I get this error:
File "/usr/local/lib/python3.4/dist-packages/mutpy/codegen.py", line 498, in visit_ExtSlice for idx, item in node.dims: TypeError: 'Slice' object is not iterable

I solved it replacing the visit_ExtSlice method with this:
` def visit_ExtSlice(self, node):

    for i in range(0, len(node.dims)):
        if i > 0:
            self.write(', ')
        self.visit(node.dims[i])`
@andreif
Copy link
Owner

andreif commented Mar 21, 2018

You will have more issues with complex expressions, so please try astor.

@serhiy-storchaka
Copy link

Seems there is a missing enumerate() call.

for idx, item in enumerate(node.dims):

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

3 participants