> Also I think this is often alleviated by using super().
super doesn't help for my use case or not in any way I can see.
> Maybe it is possible to preserve backwards compatibility by making
ast_list a subclass of list? Or is it not possible for some reason?
There is a layout conflict between
> This part could be solved without making the lists AST nodes at all. Just
use new bare subclasses of list for each of the kinds of lists, so a field
in a node never has an empty list, it has an empty ExprList or StmtList or
whatever. If that’s sufficient for your needs, that seems pretty easy,
On Aug 15, 2019, at 13:02, Caleb Donovick wrote:
>
> When walking an ast it impossible to know the type of an empty list without
> writing down some giant lookup from node types and field names to field types.
This part could be solved without making the lists AST nodes at all. Just use
new
Just to make sure we're on the same page: what are you using the ast module
for?
Maybe moving to another lib like parso actually helps your real problem more...
> On 15 Aug 2019, at 22:02, Caleb Donovick wrote:
>
> When walking an ast it impossible to know the type of an empty list without
Hey everyone,
I've been using cProfile to profile some of my code, but found out that while
the tools to print the results are very convenient, it was difficult to extract
and send to a logging tool (i.e. fluentd) where it can be further parsed and
analyzed. I'm thinking of adding a function
> On 16 Aug 2019, at 21:44, Caleb Donovick wrote:
>
> > This part could be solved without making the lists AST nodes at all. Just
> > use new bare subclasses of list for each of the kinds of lists, so a field
> > in a node never has an empty list, it has an empty ExprList or StmtList or
> >
> True for yourself, I assume. But json.dumps is *not* why *the rest of
> us* do that. We do it because we've *always* done it. The Python
> objects we are serializing themselves lack units, precision, and pet's
> name! Until our Python programs become unit- and precision- aware,
> support
On one hand I can see how this may cause little inconvenience, but on other
hand this would be a breaking change, so I don't think it is realistic.
Also I think this is often alleviated by using super().
Maybe it is possible to preserve backwards compatibility by making ast_list
a subclass of
Wes Turner writes:
> Data interchange with structured types is worthwhile.
That's not what the main thread is about. It's about adding support
for Decimal to the stdlib's json module. Even the OP has explicitly
disclaimed pretty much everything else, although his preferred
implementation is