On Thu, Dec 14, 2017 at 6:41 AM, vitalije <[email protected]> wrote:

> | ast.walk chaotic order
>
> It certainly has its drawbacks. However, it can help to shift programmers
> mind more towards sets and pure functions and away from procedural way of
> thinking.
>
> As you can see in given example I had to operate on ClassDefs and
> FunctionDefs in more strict ordering, so operations on them are done in
> separate walks. It is possible to use ast.walk on narrower scopes
> (ClassDef, or FunctionDef).
>

​This is fascinating and productive discussion we are having.

Yesterday's Eureka has morphed into something simpler and better.  However,
unexpected problems arose. I am in the midst of writing about the new
pattern in a new thread, but first I wanted to respond to your comments
here.

I have just review both your code in LeoCheck.leo​ and the pyflakes code.
Your code has more in common with pyflakes than with my AstFormatter and
AstFullTraverser classes. Imo, that's a strong recommendation for your
approach. And yet...

The AstFormatter and AstFullTraverser classes are useful tools.  Imo, it's
a pity that something like them are not part of the standard ast module.
Alas they aren't, and I suppose they never will be.

Without AstFullTraverser, pyflakes makes do with the iter_child_nodes
method, that uses the _FieldsOrder class. This class is short and it works,
but it's a hack.

Well, something like iter_child_nodes *might* work for the AstFullTraverser
class (I have doubts), but it has *no chance* of working in the
AstFormatter class. That class must visit children explicitly.

​In short, the AstFormatter and AstFullTraverser classes contain surprises,
but I happen to need them both right now. I'll discuss the complications in
another thread.

Edward

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.

Reply via email to