Author steven.daprano
Recipients kellerfuchs, mark.dickinson, rhettinger, serhiy.storchaka, steven.daprano, tim.peters
Date 2018-12-07.14:52:18
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
In-reply-to <>
> > Mathematically, `binomial(n, k)` for `k > n` is defined as 0.
> It's not so clear cut. You can find different definitions out there. 
> Knuth et. al., for example, in the book "Concrete Mathematics", extend 
> the definition not just to negative k, but to negative n as well. 
> Mathematicians aren't very good at agreeing on things. :-)

I think the key word there is *extend*. To the degree that any 
mathematical definition is "obvious", the obvious definition for number 
of combinations ("n choose r") is going to be 1 for r == 0 and 0 for r > n.

However, I think that it is too easy to get the order of n and r (n and 
k) mixed up, and write combinations(5, 10) when you wanted to choose 5 
from 10. I know I make that mistake on my calculator *all the time*, and 
so do my students, even with the nPr notation. So I recommend we raise 
ValueError for r > n.
Date User Action Args
2018-12-07 14:52:18steven.dapranosetrecipients: + steven.daprano, tim.peters, rhettinger, mark.dickinson, serhiy.storchaka, kellerfuchs
2018-12-07 14:52:18steven.dapranolinkissue35431 messages
2018-12-07 14:52:18steven.dapranocreate