An open API service indexing awesome lists of open source software.

https://github.com/dexpota/cpython-api-examples

Some examples of using the C API of python 2.7.
https://github.com/dexpota/cpython-api-examples

Last synced: 12 months ago
JSON representation

Some examples of using the C API of python 2.7.

Awesome Lists containing this project

README

          

# cpython cookbook

[![License:MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

## Examples

- 00 **Extending python with C/C++**: a simple python module written in C/C++ with an hello-world function;

- 01 **Errors and exceptions**: this recipe shows how to create a custom exception and raise it back into Python;

- 02 **Python callback inside a C/C++ module**: this recipe shows how to pass a python function into the module and call it inside the C/C++ module;

- 03 **Variable-length arguments and keyword arguments**: this recipe shows how to handle variable-length arguments and keyword arguments;

- 04 **Custom type**: this recipe shows how to define a custom data type inside the C/C++ module;

- 05 **Embedding python inside C/C++**: this recipe shows how to integrate a python interpreter inside a C/C++ program;

- 06 **Executing python inside C/C++**: this recipe shows how to run a simple C string as python code;

## Contributing

- Fork it!
- Create your feature branch: `git checkout -b my-new-feature`
- Commit your changes: `git commit -am 'Add some feature'`
- Push to the branch: `git push origin my-new-feature`
- Submit a pull request :D