Current thinking on required options

Peter J. Holzer hjp-python at hjp.at
Mon Apr 19 13:45:35 EDT 2021


On 2021-04-19 16:38:24 -0000, Jon Ribbens via Python-list wrote:
> On 2021-04-19, Paul Bryan <pbryan at anode.ca> wrote:
> > Calling them options—when they're required—seems like a problem. 🙂
> 
> The option is what the value is, not whether there is a value at all.
> If you order a coffee then you may have an option as to what temperature
> it is, that doesn't mean the coffee having a temperature is optional.

No, but you having to specify the temperature is optional. Yoy might
order an extra-hot coffee or s luke-warm coffee, but most of the time
you will just order a coffee and accept it being at the default
temperature.

I would agree with others that options should in general be optional.

I do break that that rule sometimes, though: If there are several
required arguments and they have no obvious natural order, I might use
required options for those just to prevent the user (me) from swapping
them.

        hp

-- 
   _  | Peter J. Holzer    | Story must make more sense than reality.
|_|_) |                    |
| |   | hjp at hjp.at         |    -- Charles Stross, "Creative writing
__/   | http://www.hjp.at/ |       challenge!"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://mail.python.org/pipermail/python-list/attachments/20210419/1fab76f3/attachment.sig>


More information about the Python-list mailing list