[C++-sig] Inconsistency with Boost.Python code

Stefan Seefeld seefeld at sympatico.ca
Thu Oct 9 20:33:21 CEST 2008


Robert wrote:
>
> Do copies occur only between object to dict? or does it also copy from 
> dict to dict? or list to list? I'm still not 100% sure if the copy or 
> reference counting is deterministic.

See 
http://www.boost.org/doc/libs/1_36_0/libs/python/doc/tutorial/doc/html/python/object.html#python.derived_object_types 
(look for 'pitfall')

Note that what you did in C++ (dict d(...)) corresponds to this in Python:

d = dict(...)

which also creates a copy. Boost.python is simply being consistent with 
Python here.

(Yes, this keeps confusing me, too...)


HTH,
       Stefan


-- 

      ...ich hab' noch einen Koffer in Berlin...




More information about the Cplusplus-sig mailing list