python in c++ application

This is a discussion on python in c++ application within the C++ Programming forums, part of the General Programming Boards category; Hello..
I would like to add some scripting to my c++ aplications, so that users would be able to customize ...

It's possible with Boost.Python, yes. Embedding the Python interpreter in the C++ program is a bit ... iffy, but it works. As for the code size increase - well, you have to distribute the Python interpreter with your app, but it's a shared library, not part of the exe. As for Boost.Python itself, I can only say, try it out.

Note: In my opinion, the Python embedding/extension API is a prime example of how not to design an API. Here's a tip if you're working with it: if any function takes a non-const char* as a parameter, even though there's absolutely no reason why Python should want to modify that string, then this means:
1) Python won't modify the string. However, it also expects you not to do so.
2) You are responsible for keeping this string alive long enough. No function-local buffers! (That has bitten me hard.)
3) Long enough typically means until you shut down the Python interpreter.

In particular, if you load a module from C++ code, the module name parameter is such a string.

I had in mind I could use python as a scripting language for my application - only c++ functions that I would declare/define for scripting, would be used there..

For instance if user wanted to output mp3 information, he would be able to customize it like this:
"$artist - $title ($length) - $rand_num(function_parameteres)"..

would output:
"Some Artist - Unknown track (3:00) - 9382"

Maybe user could write this as python script and this would be stored as a string inside my program. This string would later be processed by c++ application. Is this possible? Would kind of approach be good?

I thought it would be the best way to solve that kind of problem using some scripting language inside my application.. That would even allow users to have more options to customize (using variables, etc.)

Would it be more suitable to use some other approach to this? I already tried solving that kind of thing using boost spirit, and I wasnt glad with results.. Maybe boost range would be more suitable?