>> - Some fixes Robert pointed me to (for TreeFragment / ExprStatNode)
>
> The SubstitutionTransform still needs to be able to handle multiple
> substitutions in one pass--e.g. to do stuff like a -> b, b -> c, and
> c -> a.

Ahh... I didn't have that goal at all, in fact I want to avoid this. (Or
am I missing something here? Please elaborate, it's not clear to me what
you want to achieve.)

If my guess it right, perhaps the fix is a rename to TemplateTransform,
and then we can have another SubstitutionTransform doing what you want if
needed?

Remember that the usecase is for TreeFragment:

def complicated_create_assignment(varname, expr):
    result = TreeFragment("LEFT = RIGHT").substitute({"LEFT" :
NameNode(varname), "RIGHT" : expr})

So, if "RIGHT" is passed as varname, your suggestion would make "expr"
appear on both sides, *not* what was intended! (and what happens if
passing "LEFT" as varname -- infinite recursion?_

(However, it should properly assign pos to substituted nodes (which it
does not), I'll try to remember to do that next time I'm coding.)

Dag Sverre

_______________________________________________
Cython-dev mailing list
Cython-dev@codespeak.net
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to