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

  • Home
  • SEARCH
  • 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 943713
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T22:28:39+00:00 2026-05-15T22:28:39+00:00

I need to programmatically get the number of arguments that a function requires. With

  • 0

I need to programmatically get the number of arguments that a function requires. With functions declared in modules this is trivial:

myfunc.func_code.co_argcount

But built-in functions don’t have the func_code attribute. Is there another way to do this? Otherwise I can’t use the built-ins and have to re-write them in my code.

[addition] Thanks for the responses, hope they’ll be useful. I have used Pypy instead.

  • 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-15T22:28:40+00:00Added an answer on May 15, 2026 at 10:28 pm

    Take a look at the function below copied from here. This may be the best you can do. Note the comments about inspect.getargspec.

    def describe_builtin(obj):
       """ Describe a builtin function """
    
       wi('+Built-in Function: %s' % obj.__name__)
       # Built-in functions cannot be inspected by
       # inspect.getargspec. We have to try and parse
       # the __doc__ attribute of the function.
       docstr = obj.__doc__
       args = ''
    
       if docstr:
          items = docstr.split('\n')
          if items:
             func_descr = items[0]
             s = func_descr.replace(obj.__name__,'')
             idx1 = s.find('(')
             idx2 = s.find(')',idx1)
             if idx1 != -1 and idx2 != -1 and (idx2>idx1+1):
                args = s[idx1+1:idx2]
                wi('\t-Method Arguments:', args)
    
       if args=='':
          wi('\t-Method Arguments: None')
    
       print
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to get a file from sourcesafe database programmatically. Any idea of how
I am creating a C# Windows Mobile application that I need to programmatically invoke
As an SEO metric I'd like to programmatically get the number of by Google
I'm writing a program and I need to get the version number and publisher
I need to programmatically solve a system of linear equations in C, Objective C,
I need to programmatically determine out how many sectors, heads, and cylinders are on
I need to programmatically enable READ COMMITTED SNAPSHOT in SQL Server. How can I
I have a C code base and need to programmatically identify all of the
I have a database full of small HTML documents and I need to programmatically
I have G729 encoded audio files. I need to programmatically convert them to WAV

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.