Larry Hastings added the comment:
In the case of namedtuple and Enum, the parameter represents a sequence of
strings--order is significant. With the 'types' parameter for converters, the
internal model was always meant to be a *set* of strings. The order was
explicitly *not* significant. So types="str robuffer" and types="robuffer str"
should be identical. Your "harder to search in sources" was already true.
Argument Clinic isn't something very many people will learn. Lots of people
will read the conversions, but few will ever write a conversion, and they won't
do it often and they'll forget the funny details. So we shouldn't make the API
quirky and succinct at the expense of readability. The best API will be one
that makes the code easier to read.
I think requiring types to be a set of strings makes it easier to read because
it makes the semantics obvious. If you see
types="str robuffer"
you aren't sure if order is significant, but if you see
types={'str', 'robuffer'}
you are certain it is not.
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue23935>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com