What is the ctx argument in the Python AST representation? For example:
>>> print(ast.dump(ast.parse('-a')))
Module(body=[Expr(value=UnaryOp(op=USub(), operand=Name(id='a', ctx=Load())))])
In other words, what does ctx=Load() mean or do? The only information I'm able to see from the docs is that the ctx may be one of:
expr_context = Load | Store | Del | AugLoad | AugStore | Param
https://docs.python.org/3.7/library/ast.html. Could someone explain the various expr_context and what those do? I suppose lhs and rhs are the store/load:
>>> print(ast.dump(ast.parse('b=-a')))
Module(body=[Assign(targets=[Name(id='b', ctx=Store())], value=UnaryOp(op=USub(), operand=Name(id='a', ctx=Load())))])
But beyond that, what are all the other options?
Update: Also, yes there is another question similar to this, Python AST: several semantics unclear, e.g. expr_context, but the accepted answer starts with "After some more testing and guessing:..." and it pretty light (to say the least) on details. I'm hoping that someone who actually understands the ast module a bit more can provide a more thorough answer.