Vajrasky Kok added the comment: paul j3, thanks for reviewing my patch and giving me credit in your patch for another ticket.
Yeah, as you could see, the reason I return arg_parts and text is because the text still needs to undergo the cleanup process. You solved it by putting cleaning up in inner function. I am thinking whether it is best to do "assert ' '.join(opt_parts) == opt_usage" inside _format_actions_usage helper function. In that way, we can avoid returning the text. We can return only the arg_parts. Anyway, my patch still got some unused variables, notably part_regexp and inner. My bad. Let me check the code more deeply. See whether I can architect my patch in a better way. Maybe we can avoid building separate list inside _format_actions_usage. Beside of that, this bug is not introduced solely by bracket character. It needs another non-space character on the right side of it. This line is fine: parser.add_argument ('--b', metavar="[innerpart] outerpart") This line will fail the assertion: parser.add_argument ('--b', metavar="[innerpart]outerpart") ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue11874> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com