One additional idea you might entertain as long as you are thinking about 
argument parsing functions.  Most command line processing functions return 
a string, and it is up to the downstream code to convert it to an int, 
float, whatever.  My own - overly simple, for sure - includes an optional 
default value in its function signature.  The code returns the argument 
already cast to the type of the default value.

One might raise the question of separation of concerns - an argument parser 
doesn't need to know about the argument's types, perhaps - but usually 
there is a default value provided somewhere, and why not put it in the code 
that returns the argument?

On Friday, June 16, 2023 at 3:23:49 PM UTC-4 Edward K. Ream wrote:

> On Friday, June 16, 2023 at 1:46:37 PM UTC-5 Edward K. Ream wrote:
>
> a *stateless *class, say *g.OptionsUtils*, would simply package a set of 
> functions. I am going to experiment with this pattern.
>
>
> Experiments show that just adding four functions to leoGlobals.py is more 
> convenient.
>
> The latest code is in PR #3389 
> <https://github.com/leo-editor/leo-editor/pull/3389>.  All comments 
> welcome.
>
> Edward
>

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to leo-editor+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/leo-editor/df0f1ae0-faad-47e1-83a6-ddae407fb7dfn%40googlegroups.com.

Reply via email to