yeah, that's how it is. itertools.combinations gives you subsequences. if you want the nCr number you have to implement it yourself. good responses on this SO question, gives a more efficient way than using factorialhttps://stackoverflow.com/questions/4941753/is-there-a-math-ncr-function-in-python …
-
-
-
Glad to have it confirmed, thanks. Yes, I was looking for the nCr number function.
-
it is surprising that it's not in the standard library. kinda goes against the "batteries included" design philosophy of Python to exclude it like this, even though its simple to implement it yourself.
-
Yeah, that’s why I asked publicly. I wondered if there were some less used mathy library I hadn’t come across yet. Easy enough to add it to my own modules, but just seemed odd.
End of conversation
New conversation -
-
-
hmm. I'm 80% sure I've seen it somewhere. Let me see if I can refind it or whether my memory is lying to me.
-
Yay…I got an attribute error with scipy.misc or comb for integers, but this worked: https://docs.scipy.org/doc/scipy-0.19.1/reference/generated/scipy.misc.comb.html … Thanks! cc.
@danlistensto for info -
You're probably seeing something like https://gist.github.com/DRMacIver/4dbf57071f9517dc767128b1dfd71d7f … ? This is due to shenanigans with how Python's module system works. Modules inside packages aren't available as attributes on the module until you've imported them.
-
Ah ok yes, I’ve run into this before. But it seems to be true for some modules, not others (eg numpy?) Or maybe I’m confused. Importing the misc module, I get a deprecation warning. But scipy.special does the trick nicely.pic.twitter.com/8oEM2Omxg8
-
Yeah the confusing thing about this behaviour is that once you've imported the module anywhere in your program, it becomes available on the package. Sometimes this happens because the module is used internally.
-
The result is there's basically no rhyme or reason as to when it works, it just sometimes happens to, but it will always work if you import the module.
End of conversation
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.