Default value for argument gets assigned to option
See original GitHub issue"""
Usage:
bug.py [--opt num] [ARG]
Options:
--opt num An option with a value
Arguments:
ARG An arg with a default [default: A]
"""
from docopt import docopt
arguments = docopt(__doc__)
print arguments
I expect this to show:
{'--opt': None, 'ARG': 'A'}
What actually happens:
{'--opt': 'A', 'ARG': None}
I’ll take a look into a fix tomorrow if I can.
Issue Analytics
- State:
- Created 11 years ago
- Comments:15 (11 by maintainers)
Top Results From Across the Web
Default parameters - JavaScript - MDN Web Docs
Default function parameters allow named parameters to be initialized with default values if no value or undefined is passed.
Read more >Default arguments in Python - GeeksforGeeks
The default value is assigned by using the assignment(=) operator of the form keywordname=value. Let's understand this through a function ...
Read more >Setting default value for TypeScript object passed as argument
The trick is to first put in brackets what keys you want to pick from the argument object, with key=value for any defaults....
Read more >The Beginner's Guide to JavaScript Default Parameters
In the first function call, we didn't pass any argument into the say() function, therefore message parameter took the default value 'Hi' ....
Read more >Default arguments - cppreference.com
A redeclaration cannot introduce a default for an argument for which a default is already visible (even if the value is the same)....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hey, what’s the status on this? I would really like to be able to set a default for an optional positional argument.
Same question as @bear24rw, anybody on the topic nowadays ?