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

Ask A Question

Stats

  • Questions 531k
  • Answers 531k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer If mysql was being properly loaded, you'd have seen something… May 16, 2026 at 11:49 pm
  • Editorial Team
    Editorial Team added an answer Write a program that reads the 100 byte data file… May 16, 2026 at 11:49 pm
  • Editorial Team
    Editorial Team added an answer Setting the UnderlaySection Property of the Section to false solved… May 16, 2026 at 11:49 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

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've got a project going where I need to programmatically load DLLs and run
I need to retrieve the number of fans for a given Facebook application. Using
I need to display the .NET Compact Framework version number on the screen. I
using c# (asp.net) i'm programmatically creating several drop down lists (random number). the user
Trying to programmatically get the private working set of a process. Currently I am
I need the correct way of getting latitude and longitude in Android programmatically. I
I have a page that displays a grid of products that is populated programmatically
For example, /(\w+) (?:\+) (\w)/ that regexp must return 2. I must apologize for

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.