On this page
  1. argparse.MetavarTypeHelpFormatter
  2. Import
  3. Signature & Overview
  4. Methods & Attributes
  5. Usage
  6. Gotchas
  7. REPL Inspect

argparse.MetavarTypeHelpFormatter

Prev: argparse.HelpFormatter | Up: argparse | Next: argparse.Namespace
Rel: argparse.Action, argparse.ArgumentDefaultsHelpFormatter, argparse.ArgumentError, argparse.ArgumentParser
Ref: docs.python.org — argparse.MetavarTypeHelpFormatter
Tags: #public #python3 #stdlib #argparse


Import

import argparse
from argparse import MetavarTypeHelpFormatter

Signature & Overview

argparse.MetavarTypeHelpFormatter(prog, indent_increment=2, max_help_position=24, width=None, color=True)

Help message formatter which uses the argument 'type' as the default metavar value (instead of the argument 'dest') Only the name of this class is considered a public API. All the methods

Methods & Attributes

Usage

import argparse

p = argparse.ArgumentParser(formatter_class=argparse.MetavarTypeHelpFormatter)
p.add_argument("--retries", type=int, help="Max attempts")
assert "--retries int" in p.format_help()

Gotchas

REPL Inspect

from argparse import MetavarTypeHelpFormatter
help(MetavarTypeHelpFormatter)

Linked from

Related notes