Skip to content

ast produced seems out of date w.r.t. module changes #5

Description

@alecastle

for a simple example, the input

x.sort(reverse=True)

comes out as follows in the tool:

image

However, in the latest version of Python (3.8.1 as of this writing), the following AST is produced:

>>> ast.dump(ast.parse("x.sort(reverse=True)"))
"Module(body=[Expr(value=Call(func=Attribute(value=Name(id='x', ctx=Load()), attr='sort', ctx=Load()), args=[], keywords=[keyword(arg='reverse', value=Constant(value=True, kind=None))]))], type_ignores=[])"

That's a little hard to read, so let's look specifically at the keywords part:

keywords=[keyword(arg='reverse', value=Constant(value=True, kind=None))]

Here, the value of the keyword is an ast.Constant object, as opposed to the ast.Name object presented in the output of the tool. The documentation of the ast module is very sparse, so I'm not sure in what version this was introduced, but suffice it to say this is proof that the tool is out of date.

Activity

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