Cleaner way to get a list-based AST #892
ThatXliner
started this conversation in
Ideas
Replies: 1 comment 3 replies
-
Well, you can do class XlinerList((list, _Ast, ast_utils.AsList):
pass
class Things(XlinerList):
pass Doesn't seem that bad. |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Currently, in order to make a list for an AST component, you'll need to subclass
ast_utils.Ast
andast_utils.AsList
to makeast_utils
stuff a list. Right now, I have to writeBut I wish that instead of making an entirely new dataclass for a list (multiple) of
thing
s, I wanted a function or an extra argument I can pass toast_utils.create_transformer
. Actually, I just wanted a list. So what I have right now is actually more of a monstrosity.I figured I can do some black magic and make a factory function on my own (which should modify the
Transformer
subclass) but this is just an idea to add it toast_utils
.Is there a cleaner way?
Beta Was this translation helpful? Give feedback.
All reactions