2323def count_required (subset : ParamTuple ) -> int :
2424 """Return the number of arguments which cannot be omitted.
2525
26- Trailing parameters with a default value which are not in an optional
27- group can be omitted.
26+ A parameter in an optional group is passed together with its group,
27+ so only trailing parameters with a default value can be omitted.
2828 """
2929 count = len (subset )
3030 for p in reversed (subset ):
@@ -314,9 +314,7 @@ def render_option_group_parsing(
314314 assert group is not None
315315 group .append (p )
316316
317- # Map the number of arguments to the subset which accepts them.
318- # A subset accepts a range of counts, because its trailing parameters
319- # with a default value which are not in any group can be omitted.
317+ # Map the number of arguments to the subset which accepts it.
320318 subsets : dict [int , ParamTuple ] = {}
321319 for subset in permute_optional_groups (left , required , right ):
322320 for count in range (count_required (subset ), len (subset ) + 1 ):
@@ -333,8 +331,7 @@ def render_option_group_parsing(
333331 out .append (f"switch ({ nargs } ) {{\n " )
334332 for count , subset in sorted (subsets .items ()):
335333 if count < len (subset ):
336- # Some of the trailing parameters are omitted;
337- # they are parsed together with the following case.
334+ # The omitted parameters are parsed by the following case.
338335 out .append (f" case { count } :\n " )
339336 continue
340337
0 commit comments