[Tutor] Difference between max(one, two) and max((one, two))

Dave Angel davea at davea.name
Wed Jul 10 12:53:44 CEST 2013


On 07/05/2013 02:37 PM, Amandeep Behl wrote:
> and why with sum(one, two) we get an error whereas not with sum((one, two))
> ?
>

When replying to a message, your new text should go AFTER the quote. 
Putting it first is called top-posting, and it's a Microsoft-introduced 
abomination that's not compatible with newsgroups.

>
> On Fri, Jul 5, 2013 at 11:27 AM, Amandeep Behl <amandeep.qa at gmail.com>wrote:
>
>> What is the difference between max(one, two) and max((one, two)) ?
>>

When you call max(one, two) you are passing two arguments to max().  The 
second way you are calling it with one argument, and that argument is a 
tuple.

It happens that max() is happy either way.  But for most functions, such 
as sum(), it makes a big difference.  And even with max(), if you had 
included other arguments, such as keyword argument key=, you would have 
seen a difference.


-- 
DaveA



More information about the Tutor mailing list