[Tutor] Difference between max(one, two) and max((one, two))
eryksun
eryksun at gmail.com
Wed Jul 10 19:42:27 CEST 2013
On Wed, Jul 10, 2013 at 6:53 AM, Dave Angel <davea at davea.name> wrote:
> And even with max(), if you had included other arguments, such as keyword
> argument key=, you would have seen a difference.
CPython max() is declared METH_VARARGS | METH_KEYWORDS, so it's called
with both an args tuple and a kwds dict. Using a keyword argument
other than "key" will raise a TypeError. As far as unpacking the args
tuple, if it's length 1 then the first argument is assumed to be an
iterable. Otherwise the args tuple itself is used as the iterable.
More information about the Tutor
mailing list