[EMAIL PROTECTED] wrote: >> We're getting closer and closer to something I already posted a few >> times here. This implementation was unfortunate because I consistently >> used an uncommon name for it so people couldn't easily find it > > But then, who's looking for it?
The OP was trying to find it in the docs, assuming it was some kind of builtin function. I can see the logic of that and I can also see the logic of including some other smallish functions like for example fac. Failing that, the next recourse would be the Internet, or a Usenet search but that would imply well named Usenet posts and function names. >> (mea culpa), and maybe also because it uses the despised reduce builtin. >> >> def noverk(n,k): >> � � �return reduce(lambda a,b: a*(n-b)/(b+1),xrange(k),1) This is a rather concise function which has the added advantage that it returns 0 when k>n. >> BTW I hereby give up the strange name for this and request a better name >> that everybody will use so there will be no confusion anymore. Maybe >> comb(n,k) ? > > No, that name's already used by gmpy. And a single > function doesn't replace all of gmpy's other > functionality, many of which are needed in the > same applications where comb() is used, so there's > really no need for your function. Actually, by proposing comb I am *honoring* gmpy and I'm also complying with it. In Python we use namespaces to differentiate between such things. You might want to read the documentation about it some time. > Your time is better spent applying the tools provided > by gmpy rather than trying to re-invent the wheel. Please let me be the judge of how to spend my time. In this case it seems rather unjustified to introduce dependencies on external modules when only a few functions are needed. Since I'm also interested in the functions themselves -in this case- I'd rather have a few lines of code in my source than importing an optimized code library. There *are* situations where such things are completely justified, but I don't think this is one of them. You could take it up with the gmpy author and induce him to get gmpy included in the standard distro if you are so inclined. A. -- http://mail.python.org/mailman/listinfo/python-list