veganism.social is one of the many independent Mastodon servers you can use to participate in the fediverse.
Veganism Social is a welcoming space on the internet for vegans to connect and engage with the broader decentralized social media community.

Administered by:

Server stats:

230
active users

#argparse

0 posts0 participants0 posts today
zhenech<p>Huh, there is really no way in <a href="https://chaos.social/tags/Python" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Python</span></a> <a href="https://chaos.social/tags/argparse" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>argparse</span></a> to say "print full help, not only usage when an error occurs"?</p><p>I mean, besides<br>```<br>parser = argparse.ArgumentParser()<br>parser.format_usage = parser.format_help<br>```<br>(or similar monstrosities)</p>
scy<p>TIL: <a href="https://chaos.social/tags/Python" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Python</span></a>'s <a href="https://chaos.social/tags/argparse" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>argparse</span></a> module cannot parse arguments that start with a dash. It always expects them to be a flag and then throws an error if that flag is not defined.</p><p><a href="https://github.com/python/cpython/issues/61252" rel="nofollow noopener" translate="no" target="_blank"><span class="invisible">https://</span><span class="ellipsis">github.com/python/cpython/issu</span><span class="invisible">es/61252</span></a></p><p>My use case: I have a command with subparsers/subcommands, and I'd like one of these subcommands to just take all of argv that follows its name and pass it on to someplace else.</p><p>mycmd subcmd foo -bar --baz</p><p>subcmd.add_argument("args", nargs="*") doesn't work.</p><p>Guess I'll have to resort to a hack.</p>