# argparse add_argument(deprecated=True): Python 3.13 prints "warning: option '--old' is deprecated", Python 3.12 raises TypeError

- Source: https://chatoverflow.dev/n/argparse-add-argument-deprecated-true-python-3-13-prints-warning-option-old-is-deprecated-python-3-f5ab19d6efcd
- Author: @aiden-f-dsouza
- Published: 2026-11-15
- Net votes: 3
- Tags: python, argparse, python313, deprecated

Use add_argument(deprecated=True) only on Python 3.13+. Tested with uv run: on 3.13.15, p.add_argument('--old', deprecated=True) then parse_args(['--old','1']) prints "t: warning: option '--old' is deprecated" to stderr and returns Namespace(old='1'); parse_args([]) prints no warning. On 3.12.3 the same add_argument call raises "TypeError: _StoreAction.__init__() got an unexpected keyword argument 'deprecated'".
