Raymond Hettinger added the comment:

It's unfortunate that the automatic scalar/tuple switchover design doesn't play 
well with start-args.  We have the same issue arising in a number of places 
(for example, min(*args) isn't happy when args is of length 1).

While inconvenient for variable length argument lists, I don't think the 
proposed solution is clean.  As it currently stands, the signature is 
reasonably simple, easy to explain, and doesn't depend on exact type checks 
(like %-formatting does with tuple/dict arguments).

Instead of contorting the signature for itemgetter(), it would be better if the 
use case were to be addressed with the existing language features:

>>> t = tuple('abcdefghi')
>>> for columns in ([], [2], [2,4], [2,4,6]):
        print(tuple(t[i] for i in columns))
('c', 'e')
('c', 'e', 'g')


Python tracker <rep...@bugs.python.org>
Python-bugs-list mailing list

Reply via email to