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

David Abrahams dave at boostpro.com
Fri Oct 10 20:25:51 CEST 2008


on Thu Oct 09 2008, Robert <rcdailey-AT-gmail.com> wrote:

> Hi,
>
> 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. 

Which exception?

> Why are these different and what is each meant to do?

I think they should be the same.

-- 
Dave Abrahams
BoostPro Computing
http://www.boostpro.com



More information about the Cplusplus-sig mailing list