[issue38765] `ast.AST._attributes` is used by `ast.dump()` but not documented

2019-11-21 Thread Pekka Klärck
Pekka Klärck added the comment: I'd say `_attributes` is already exposed as defining it in your own node affects many of the functions in the ast module. For example, `ast.dump(node, include_attributes=True)` makes no sense otherwise. Whatever was the reason for the leading underscore must be

[issue38765] `ast.AST._attributes` is used by `ast.dump()` but not documented

2019-11-20 Thread Brett Cannon
Brett Cannon added the comment: It's also possible the leading underscore was used to prevent name collisions. Unfortunately I don't know the history of _attributes, so without someone digging through the git history or personally knowing the reason behind it I don't know whether we should b

[issue38765] `ast.AST._attributes` is used by `ast.dump()` but not documented

2019-11-19 Thread Terry J. Reedy
Terry J. Reedy added the comment: Nosying the ast experts, which I meant to do before. -- nosy: +benjamin.peterson, brett.cannon, yselivanov ___ Python tracker ___ ___

[issue38765] `ast.AST._attributes` is used by `ast.dump()` but not documented

2019-11-15 Thread Pekka Klärck
Pekka Klärck added the comment: I know attributes starting with an underscore are typically considered private, but the already mentioned `_fields` clearly isn't and, for example, `namedtuple` has several methods like `_asdict()` and `_replace()` that are documented to be part of the public A

[issue38765] `ast.AST._attributes` is used by `ast.dump()` but not documented

2019-11-15 Thread Terry J. Reedy
Terry J. Reedy added the comment: A leading underscore usually means that the name is private and should not be relied on. We of course use private names to implement public objects, else they should not exist. '_fields' is an exception, and I leave it to the ast experts to decide if '_att

[issue38765] `ast.AST._attributes` is used by `ast.dump()` but not documented

2019-11-11 Thread Pekka Klärck
Pekka Klärck added the comment: Based on the `ast` source code there are also other functions that use the undocumented `_attributes` attribute: - copy_location - fix_missing_locations - increment_lineno -- ___ Python tracker

[issue38765] `ast.AST._attributes` is used by `ast.dump()` but not documented

2019-11-11 Thread Pekka Klärck
New submission from Pekka Klärck : We have implemented an ast for our own tool so that we extend Python's standard `ast.AST`. When using `ast.dump(node, include_attributes=True)`, we were surprised to notice that line numbers weren't dumped although the docs of `ast.dump()` said they should be