Axel <p...@jejajo.de> added the comment:

Thanks for so fast looking into this.

Good idea to use the workaround with a own conversion function. I'll use this 
for now.

To see what's happening, I tried a own Action with print in __call__ and a own 
conversion function with printing. I found following workflow:
1) direct assignment of unconverted default value (if not SUPPRESS, in 
parse_known_args)
2) conversion of argument string into given type
3) call to Action.__call__ which sets the converted value
4) only in edge cases: Convert default into given type and set in target

When there is no option there is only:
default  | arg, narg = '?' | --opt  | arg, narg = '*'
-----------------------------------------------------
None     | 1),     3)      | 1)     | 1), 2) with []
SUPPRESS |     2)!         |        | 
str      | 1), 2), 3)      | 1)     | 1), 2)
not str* | 1),     3)      | 1), 4) | 1), 2)

*can be int, float or other calss

It gets more complex the deeper I get into the source...

Yes, your second choice has probably less side effects.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue36078>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to