On Wed, May 20, 2020 at 06:31:51PM -0700, Christopher Barker wrote:
> I'm still confused why the ternary flag (mode) idea never comes up in these
> arguments -- I know I like that the best. But yeah, I can except that it's
> dead.
Because the standard spelling of flags in ternary logic are True, False,
and either Unknown or Maybe, and both `zip(*args, strict=Unknown)` and
`strict=Maybe` are awful.
Because Python doesn't have builtin ternary flags.
Because the usual work-around for that, forcing the falsey value None to
mean Unknown or Maybe, is rather odd; but even if it wasn't,
`strict=None` is hardly a self-explanatory API.
Because a three-state flag is not extensible past three behaviours. (And
I'm not even sure I know what you want as the third behaviour.)
If you want a *mode* parameter, the modes can be mnemonics for the
behaviour:
mode='strict' # not tolerant of length mismatches
mode='shortest' # stops at the shortest argument;
# possible future enhancements
mode='longest' # pads to the longest argument
mode='skip' # skips arguments as they become empty
mode='that thing with StopIteration that Soni wants'
The modes wouldn't have to be strings, they could be enums, although we
might not want them to be builtins.
--
Steven
_______________________________________________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
https://mail.python.org/archives/list/[email protected]/message/W47TQGIIFB5PDONPYEWUWWI72PNJKXKN/
Code of Conduct: http://python.org/psf/codeofconduct/