Skip to content

Error when parsing ExtSlice #17

Open

Description

@DevOlly

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])`

Activity

  1. andreif commented on Mar 21, 2018

    @andreif
    Owner

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

  2. serhiy-storchaka commented on Sep 29, 2018

    @serhiy-storchaka

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions