On Fri, Dec 8, 2017 at 7:25 AM, Ned Batchelder <n...@nedbatchelder.com> wrote: > On 12/7/17 2:41 PM, Ethan Furman wrote: >> >> On 12/07/2017 11:23 AM, Ned Batchelder wrote: >>> >>> On 12/7/17 1:28 PM, Ethan Furman wrote: >> >> >>>> --> identity('spam', 'eggs', 7) >>>> ('spam', 'eggs', 7) >>> >>> >>> I don't see why this last case should hold. Why does the function take >>> more than one argument? And if it does, then >>> why doesn't it work like this? >>> >>> --> identity('spam') >>> ('spam',) >>> >>> (because then it wouldn't be an identity function!) Trying to handle the >>> multi-argument case seems like it adds an >>> unneeded special case to the function. >> >> >> --> a = 'spam' >> --> a == neds_identity(a) >> False >> > > Right, but why does one argument return the argument, but n>1 returns a > tuple of the args? >
Because it's impossible to return multiple values. IMO the "identity function" is defined only in terms of one single argument, so all of this is meaningless. ChrisA -- https://mail.python.org/mailman/listinfo/python-list