Default expr_context parameters in ast to Load() · Issue #118851 · python/cpython (original) (raw)

Feature or enhancement

Proposal:

In #105858, we changed the AST node constructors to raise a DeprecationWarning when any required fields are omitted. Optional fields default to None and list fields default to an empty list. In real-world usage, it emerges that it's often also useful to omit the ctx argument to various classes (Attribute, Subscript, Starred, Name, List, Tuple); its value often does not matter, and it's convenient to have it default to ast.Load().

I'd like to backport this to 3.13 since it helps undo a noisy DeprecationWarning.

Has this already been discussed elsewhere?

This is a minor feature, which does not need previous discussion elsewhere

python/typeshed#11880 (comment)

Linked PRs