[issue14149] Argparse usage model requires argument names to be python identifiers

2012-02-28 Thread Joseph Birr-Pixton
New submission from Joseph Birr-Pixton : Say I have an argument with the name 'foo-bar'. Argparse accepts and parses arguments, but Namespace does not allow me to access the value. Yes, I can use getattr or Namespace.__dict__. But that's ugly. Yes, I can change the name of th

[issue14149] argparse: Document how to use argument names that are not Python identifiers

2012-02-29 Thread Joseph Birr-Pixton
Joseph Birr-Pixton added the comment: > I don’t understand, can you rephrase? Sorry, I mean making Namespace subscriptable. eg: >>> v = argparse.Namespace(abc = 123) >>> v Namespace(abc=123) >>> v.abc 123 >>> v['abc'] Traceback (most re