[C++-sig] C++ chain method works unexpectedly in Python

Charles Solar charlessolar at gmail.com
Mon Apr 18 03:50:57 CEST 2011


Well I know python uses ref counting, so I was hoping the support for chain
methods would be near identical to C++'s since python would not have any
reference to hold onto for Test().  It works great when inside a function,
but not so well in the global namespace. :(

On Sun, Apr 17, 2011 at 8:06 PM, Stefan Seefeld <stefan at seefeld.name> wrote:

> On 2011-04-17 20:56, Charles Solar wrote:
>
>>
>> Is there something I should be aware of here?
>>
>
> Just that Python uses garbage collection and you mustn't rely on your
> objects being destroyed at a particular point in the program flow. :-)
>
>
>   Some sort of difference between the global instances and ones defined in
>> a function?  Can I do anything so global instances are cleaned up
>> immediately like they are inside functions?
>>
>
> No idea, sorry.
>
>    Stefan
>
>
> --
>
>      ...ich hab' noch einen Koffer in Berlin...
>
> _______________________________________________
> Cplusplus-sig mailing list
> Cplusplus-sig at python.org
> http://mail.python.org/mailman/listinfo/cplusplus-sig
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20110417/dffb61c0/attachment.html>


More information about the Cplusplus-sig mailing list