Hi,

I have a C++ class that I'm exposing to Python via the Boost.Python library.
This specific class is only created from C++. In other words, it doesn't
serve the user very much good to construct an instance of this class from
Python. A typical use case for obtaining an instance of this class from
python is as follows:

import myCustomModule
fooInstance = myCustomModule.GetFooInstance()

However, I want to prevent the user from being able to do this:

import myCustomModule
fooInstance = myCustomModule.Foo()

Let's assume the class in question with private construction is Foo. The
latter code snippet would be an example of the user directly constructing an
instance of Foo(). Is there a way to prevent this through the
BOOST_PYTHON_MODULE() definition? I'm not even really sure if this can be
done natively through Python. Thanks.
_______________________________________________
Cplusplus-sig mailing list
Cplusplus-sig@python.org
http://mail.python.org/mailman/listinfo/cplusplus-sig

Reply via email to