paul j3 <ajipa...@gmail.com> added the comment:

Defaults are handled into two stages.

At the start of parsing defaults are added to the Namespace.

At the end of parsing intact defaults are evaluated with 'type'.

But a nargs='?' positional gets special handling.  It matches an empty string, 
so it is always 'seen'.  If its default is not None, that default is put in the 
Namespace instead of the matching empty list.

It's this special default handling that lets us use a ?-positional in a 
mutually exclusive group.

I suspect the error arises from this special default handling, but I'll have to 
look at the code to verify the details.

----------

_______________________________________
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