macropy icon indicating copy to clipboard operation
macropy copied to clipboard

A custom AST hierarchy for our own use

Open lihaoyi opened this issue 11 years ago • 3 comments

The default python AST objects are clunky and annoying:

  • They don't have nice __str__s or __repr__s
  • They don't have a constructor that will work with pattern matching
  • They don't have structural equality
  • Behave differently in CPython, PyPy and Jython and are probably the main reason why Jython doesn't work right now.

In general they are a pain to use. It would be great if we could have a different ast representation, either using astng or made ourselves using case classes.

lihaoyi avatar May 09 '13 02:05 lihaoyi

Can you direct me to where we're using or parsing the AST?

thedrow avatar Jun 01 '15 15:06 thedrow

Astroid doesn't parse generators yet. See https://bitbucket.org/logilab/astroid/issue/94/add-an-infer_call_result-method-for

thedrow avatar Jun 02 '15 08:06 thedrow

I don't understand how the absence of infer_call_result has any relevance to MacroPy, it looks like it's there for checking function return/call sign signatures for Pylint.

ceridwen avatar Jun 02 '15 16:06 ceridwen