[Python-ideas] A nice __repr__ for the ast.* classes?

Steven D'Aprano steve at pearwood.info
Wed May 1 03:33:10 CEST 2013


On 01/05/13 11:21, Guido van Rossum wrote:
> But do you really want it to print the entire parse tree even if it
> represents several pages of code?

Large dicts have the same problem. I can't tell you the number of times I've printed an apparently innocent dict that happened to have builtins in it. I don't think there's any good solution to this. My feeling is that the usefulness of small {dicts | parse trees} having a nice repr outweighs the inconvenience of large ones having a big repr, but I would understand if others had a different opinion.



-- 
Steven



More information about the Python-ideas mailing list