Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 642155
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T21:08:25+00:00 2026-05-13T21:08:25+00:00

This weekend I was working on a project and I needed to use a

  • 0

This weekend I was working on a project and I needed to use a binomial distribution to test the probability of an event (the probability that x of y characters would be alphanumeric given random bytes). My first solution was to write the test myself since it is rather simple.

def factorial(n):
    if n == 0:
        return 1
    else:
        return n * factorial(n-1)

def binomial_prob(n,k,p):
    bin_coeff = (factorial(n))/(factorial(k)*factorial(n-k))
    return = bin_coeff * pow(p,k) * pow((1 - p),(n-k))

And I used that. However, SciPy includes a binom_test method that does exactly this. But, for distribution this probably increases the size significantly (both SciPy and NumPy would be required) and it is for a relatively simple test. I suppose an auxiliary question is how intelligent is py2exe. Does it just import the modules I use from SciPy and NumPy, or the whole libraries. I expect just the modules that I reference, but I guess the next question is on how many modules does SciPy.stats depend on. But I digress… So my question is this, when should I use code already written at the cost of including far more than I need, and when should I just write my own implementation?

(I tagged this as python, but I suppose it could be a more general question)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T21:08:26+00:00Added an answer on May 13, 2026 at 9:08 pm

    “when should I use code already written at the cost of including far more than I need“

    Always.

    When should I just write my own implementation?

    Never.

    The “including far more than I need” question is generally quite silly. What do you care how much is “included”?

    The only time this can ever matter is when you’re writing embedded software and are severely memory-constrained.

    For all other programming — All other programming — don’t think twice. Include pre-written code early and often. Write less. Solve problems more quickly. The operating system will swap the unused pages out of memory. You can safely ignore them.

    Programming is about solving problems, not producing code. Less code is better. No code is best.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I bought Crafting Rails Applications this weekend and noticed that the author uses bundle
I am getting my senior project gallery-ready for a show this weekend. It is
I have a query that looks a bit like this: SELECT weekEnd, MAX(timeMonday) FROM
I was plugging away on an open source project this past weekend when I
I've been working through the Nexus guide this weekend and I've got everything set
This is just for my weekend project/study, I am very new to Sinatra and
Hey, I was working with a javascript project and reached a problem that I
I'm in the process of building a little project this weekend called Pirates Vs.
I have spent the weekend working on a personal project and got stuck here.
Over the weekend I realized that an application I'm working on which uses NHibernate

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.