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

2011-04-18 Thread Wichert Akkerman
On 2011-4-18 03:50, Charles Solar wrote: 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(). That is true for CPython, but may not be true for other python implem

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

2011-04-17 Thread Charles Solar
Ahh very cool, exactly what I was looking for. I did not know about __builtin__._ Figured it was something funny like that, glad its just a shell thing. Thank you On Sun, Apr 17, 2011 at 9:07 PM, INADA Naoki wrote: > Python Interactive shell stores result of an expression to a variable > named

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

2011-04-17 Thread INADA Naoki
Python Interactive shell stores result of an expression to a variable named '__builtin__._'. So, ``del _`` may help you. This behavior is only on interactive shell. When running script, '_' is not used and Python may acts you expect. On Mon, Apr 18, 2011 at 9:56 AM, Charles Solar wrote: > I hav

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

2011-04-17 Thread Charles Solar
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 P

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

2011-04-17 Thread Stefan Seefeld
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 one

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

2011-04-17 Thread Charles Solar
I have a python module written in C++, and the C++ code has a few instances that involve method chaining. I was experimenting with python support for these methods and I found something odd. However it seems this is more a python eccentricity than Boost Python, consider the following code sample.