[C++-sig] [boost.python] object: Assignment vs Construction

Robert rcdailey at gmail.com
Thu Oct 9 20:05:04 CEST 2008


I've noticed in various situations that assignment and construction of 
boost::python::object types do not do the same thing. For example, these 
two lines of code below are different at runtime:

dict ns = extract<dict>( import( "sys" ).attr( "__dict__" ) );

	-- <vs> --

dict ns( extract<dict>( import( "sys" ).attr( "__dict__" ) ) );

The latter of the two will cause an exception at runtime. Why are these 
different and what is each meant to do?

More information about the Cplusplus-sig mailing list