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 6233353
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T10:17:02+00:00 2026-05-24T10:17:02+00:00

I am new to python programming. How can I add new built-in functions and

  • 0

I am new to python programming. How can I add new built-in functions and keywords to python interpreter using C or C++?

  • 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-24T10:17:03+00:00Added an answer on May 24, 2026 at 10:17 am

    In short, it is technically possible to add things to Python’s builtins†, but it is almost never necessary (and generally considered a very bad idea).

    In longer, it’s obviously possible to modify Python’s source and add new builtins, keywords, etc… But the process for doing that is a bit out of the scope of the question as it stands.

    If you’d like more detail on how to modify the Python source, how to write C functions which can be called from Python, or something else, please edit the question to make it more specific.

    If you are new to Python programming and you feel like you should be modifying the core language in your day-to-day work, that’s probably an indicator you should simply be learning more about it. Python is used, unmodified, for a huge number of different problem domains (for example, numpy is an extension which facilitates scientific computing and Blender uses it for 3D animation), so it’s likely that the language can handle your problem domain too.

    †: you can modify the __builtin__ module to “add new builtins”… But this is almost certainly a bad idea: any code which depends on it will be very difficult (and confusing) to use anywhere outside the context of its original application. Consider, for example, if you add a greater_than_zero “builtin”, then use it somewhere else:

    $ cat foo.py
    import __builtin__
    __builtin__.greater_than_zero = lambda x: x > 0
    
    def foo(x):
        if greater_than_zero(x):
            return "greater"
        return "smaller"
    

    Anyone who tries to read that code will be confused because they won’t know where greater_than_zero is defined, and anyone who tries to use that code from an application which hasn’t snuck greater_than_zero into __builtin__ won’t be able to use it.

    A better method is to use Python’s existing import statement: http://docs.python.org/tutorial/modules.html

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

Sidebar

Related Questions

I'm new to Python and am starting to teach myself GUI programming (hopefully) using
I'm new to python programming, and I was just wondering if you can access
I'm new to python programming and using ubuntu to do so. In a program
I am new to database programming and am using sqlite and python. As an
I'm pretty new to Python programming so I have this question: How can I
I'm new in Python programming but i have a big problem: how can i
I'm relatively new to python (but not to programming), and I can't explain the
I'm new to Python, and I can say off the bat my programming experience
I'm pretty new to Python programming and would appreciate some help to a problem
Ok guys, I'm really new at python (and programming itself) so sorry for my

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.