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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T16:01:39+00:00 2026-05-31T16:01:39+00:00

Possible Duplicate: Python or Ruby Interpreter on iOS I just discovered this apps pypad

  • 0

Possible Duplicate:
Python or Ruby Interpreter on iOS

I just discovered this apps pypad and python for ios

They have like an interpreter an editor

So which app would you recomend

But most importantly, how does this interpreter work, and where can i see an example of how the obj c and python get to work togheter?

Thanks!

  • 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-31T16:01:41+00:00Added an answer on May 31, 2026 at 4:01 pm

    I am the sole creator of Python for iOS so that is of course what I would recommend, but a good indicator for your personal decision is the reviews & ratings of each App. It took me weeks to figure out how to properly integrate python into Objective-c for this App but here is the best resource to get you started (keep in mind that ObjC is just a superset of C):

    http://docs.python.org/c-api/


    Also, here is an example of calling a function defined in myModule. The equivient python would be:

    import myModule
    pValue = myModule.doSomething()
    print pValue
    

    In Objective-c:

    #include <Python.h>
    
    - (void)example {
    
        PyObject *pName, *pModule, *pDict, *pFunc, *pArgs, *pValue;
        NSString *nsString;
    
        // Initialize the Python Interpreter
        Py_Initialize();
    
        // Build the name object
        pName = PyString_FromString("myModule");
    
        // Load the module object
        pModule = PyImport_Import(pName);
    
        // pDict is a borrowed reference 
        pDict = PyModule_GetDict(pModule);
    
        // pFunc is also a borrowed reference 
        pFunc = PyDict_GetItemString(pDict, "doSomething");
    
        if (PyCallable_Check(pFunc)) {
            pValue = PyObject_CallObject(pFunc, NULL);
            if (pValue != NULL) {
                if (PyObject_IsInstance(pValue, (PyObject *)&PyUnicode_Type)) {
                        nsString = [NSString stringWithCharacters:((PyUnicodeObject *)pValue)->str length:((PyUnicodeObject *) pValue)->length];
                } else if (PyObject_IsInstance(pValue, (PyObject *)&PyBytes_Type)) {
                        nsString = [NSString stringWithUTF8String:((PyBytesObject *)pValue)->ob_sval];
                } else {
                        /* Handle a return value that is neither a PyUnicode_Type nor a PyBytes_Type */
                }
                Py_XDECREF(pValue);
            } else {
                PyErr_Print();
            }
        } else {
            PyErr_Print();
        }
    
        // Clean up
        Py_XDECREF(pModule);
        Py_XDECREF(pName);
    
        // Finish the Python Interpreter
        Py_Finalize();
    
        NSLog(@"%@", nsString);
    }
    

    For much more documentation check out: Extending and Embedding the Python Interpreter

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

Sidebar

Related Questions

Possible Duplicate: True random number generator I have worked with random functions in python,ruby,
Possible Duplicate: Dynamic module import in Python I have a list of modules, like
Possible Duplicate: Learn Python the Hard Way Exercise 17 Extra Question(S) In this exercise
Possible Duplicate: Python: simple list merging based on intersections I have a multiple list:
Possible Duplicate: Python, Printing multiple times, I'd like to know how to print a
Possible Duplicate: Python nested functions variable scoping After much trial and error I have
Possible Duplicate: comparing contents of two files using python I have a file name
Possible Duplicate: python dict.add_by_value(dict_2) ? My input is two dictionaries that have string keys
Possible Duplicate: Python Ternary Operator Does Python have an equivalent of the ternary operator?:
Possible Duplicate: Python dictionary, keep keys/values in same order as declared If I have

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.